diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2019-12-13 16:49:10 -0500 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-12-13 16:49:10 -0500 |
commit | 0ec21e2525feebe2fcd96fe5e0e3bc113ae3340e (patch) | |
tree | db146fd888a8308848529172f9cba6cb475b9150 /src/client/views/pdf/PDFViewer.tsx | |
parent | 594fc55d17f6e2b912cefec56a0217990673c04c (diff) |
server pdf stability improvements
Diffstat (limited to 'src/client/views/pdf/PDFViewer.tsx')
-rw-r--r-- | src/client/views/pdf/PDFViewer.tsx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 41825cda7..450add208 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -136,16 +136,18 @@ export class PDFViewer extends DocAnnotatableComponent<IViewerProps, PdfDocument if (matches !== null) { const properPath = Utils.prepend(`/files/pdfs/${matches[0]}`); console.log(properPath); - console.log(`The two (url and proper path) ${url === properPath ? "were" : "were not equal"}`); if (!properPath.includes(url)) { + console.log(`The two (url and proper path) were not equal`); const proto = Doc.GetProto(Document); proto[this.props.fieldKey] = new PdfField(properPath); proto[backup] = url; + } else { + console.log(`The two (url and proper path) were equal`); } } else { console.log("Outer matches was null!"); } - const path = Utils.prepend(`/files/pdf_thumbnails${this.props.url.substring("files/pdfs/".length, this.props.url.length - ".pdf".length)}-${(this.Document.curPage || 1)}.png`); + const path = Utils.prepend(`/thumbnail${this.props.url.substring("files/pdfs/".length, this.props.url.length - ".pdf".length)}-${(this.Document.curPage || 1)}.png`); this._coverPath = JSON.parse(await rp.get(path)); runInAction(() => this._showWaiting = this._showCover = true); this.props.startupLive && this.setupPdfJsViewer(); @@ -623,7 +625,8 @@ export class PDFViewer extends DocAnnotatableComponent<IViewerProps, PdfDocument } const nativeWidth = (this.Document.nativeWidth || 0); const nativeHeight = (this.Document.nativeHeight || 0); - return <img key={this._coverPath.path} src={this._coverPath.path} onError={action(() => this._coverPath.path = "http://www.cs.brown.edu/~bcz/face.gif")} onLoad={action(() => this._showWaiting = false)} + const resolved = Utils.prepend(this._coverPath.path); + return <img key={resolved} src={resolved} onError={action(() => this._coverPath.path = "http://www.cs.brown.edu/~bcz/face.gif")} onLoad={action(() => this._showWaiting = false)} style={{ position: "absolute", display: "inline-block", top: 0, left: 0, width: `${nativeWidth}px`, height: `${nativeHeight}px` }} />; } |