Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.0.15</Version>
<Version>10.0.16</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
24 changes: 16 additions & 8 deletions src/components/BootstrapBlazor.PdfReader/PdfReader.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ const disposePdf = pdf => {
const loadMetadata = (el, pdfViewer, metadata) => {
const filename = el.querySelector('.bb-view-pdf-dialog-filename');
const docTitle = el.querySelector('.bb-view-subject');
filename.textContent = docTitle.textContent;
if (docTitle) {
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null check for docTitle is added, but filename (line 199) is still accessed without a null check. If docTitle is null when ShowToolbar is false, then filename is also likely to be null. This will cause a runtime error when trying to set filename.textContent if docTitle is null. Add a null check for filename as well, or wrap both checks together.

Suggested change
if (docTitle) {
if (filename && docTitle) {

Copilot uses AI. Check for mistakes.
filename.textContent = docTitle.textContent;
}

const filesize = el.querySelector('.bb-view-pdf-dialog-filesize');
filesize.textContent = getFilesize(metadata);
Expand Down Expand Up @@ -594,10 +596,14 @@ const removeToolbarEventHandlers = el => {

const resetToolbarView = (el, pdfViewer) => {
const scaleEl = el.querySelector(".bb-view-scale-input");
updateScaleValue(el, pdfViewer.currentScale);
if (scaleEl) {
updateScaleValue(el, pdfViewer.currentScale);
}

const pageEl = el.querySelector(".bb-view-num");
pageEl.value = pdfViewer.currentPageNumber;
if (pageEl) {
pageEl.value = pdfViewer.currentPageNumber;
}

const group = el.querySelector('.bb-view-group-rotate');
if (group) {
Expand All @@ -610,11 +616,13 @@ const resetToolbarView = (el, pdfViewer) => {
}

const twoPagesOneView = el.querySelector(".dropdown-item-pages");
if (pdfViewer.spreadMode === 1) {
twoPagesOneView.classList.add("active");
}
else {
twoPagesOneView.classList.remove("active");
if (twoPagesOneView) {
if (pdfViewer.spreadMode === 1) {
twoPagesOneView.classList.add("active");
}
else {
twoPagesOneView.classList.remove("active");
}
}

delete el.widths
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid automated semicolon insertion (91% of all statements in the enclosing function have an explicit semicolon).

Suggested change
delete el.widths
delete el.widths;

Copilot uses AI. Check for mistakes.
Expand Down
Loading