aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-27 09:50:21 -0400
committerbobzel <zzzman@gmail.com>2020-09-27 09:50:21 -0400
commitb76e05d530eff780740d8b3cd15cb2ef748719d2 (patch)
tree893b840dc2a7c66f6118be82c9b157ece50f5e7d
parentee511f1e0b5ce7de221d3c6ed6251c1636db54fc (diff)
fixed bug where pdfs didn't render if they had been left on a curPage > numPages
-rw-r--r--src/client/views/pdf/PDFViewer.tsx4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index b79be2e68..17d8203cb 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -134,7 +134,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu
const coreFilename = pathComponents.pop()!.split(".")[0];
const params: any = {
coreFilename,
- pageNum: this.Document._curPage || 1,
+ pageNum: Math.min(this.props.pdf.numPages, Math.max(0, this.Document._curPage || 1)),
};
if (pathComponents.length) {
params.subtree = `${pathComponents.join("/")}/`;
@@ -143,7 +143,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu
} else {
const params: any = {
coreFilename: relative.split("/")[relative.split("/").length - 1],
- pageNum: this.Document._curPage || 1,
+ pageNum: Math.min(this.props.pdf.numPages, Math.max(0, this.Document._curPage || 1)),
};
this._coverPath = "http://cs.brown.edu/~bcz/face.gif";//href.startsWith(window.location.origin) ? await Networking.PostToServer("/thumbnail", params) : { width: 100, height: 100, path: "" };
}