aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-12-13 15:12:04 -0500
committerSam Wilkins <samwilkins333@gmail.com>2019-12-13 15:12:04 -0500
commitf49cf16cb4af2851aaa98bb2c6fce81271042fea (patch)
treee25aa40e8b30fb220f69c374f77adf6c357ea6e3 /src
parent529c9dbe42ab8f732bd8a244246eb1b94c3b5053 (diff)
path rosemary server fix
Diffstat (limited to 'src')
-rw-r--r--src/client/views/pdf/PDFViewer.tsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index a1f710617..4716e9d66 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -30,6 +30,7 @@ import { DocumentDecorations } from "../DocumentDecorations";
import { InkingControl } from "../InkingControl";
import { InkTool } from "../../../new_fields/InkField";
import { TraceMobx } from "../../../new_fields/util";
+import { PdfField } from "../../../new_fields/URLField";
const PDFJSViewer = require("pdfjs-dist/web/pdf_viewer");
const pdfjsLib = require("pdfjs-dist");
@@ -125,6 +126,16 @@ export class PDFViewer extends DocAnnotatableComponent<IViewerProps, PdfDocument
!this.props.Document.lockedTransform && (this.props.Document.lockedTransform = true);
// change the address to be the file address of the PNG version of each page
// file address of the pdf
+ const { url, Document } = this.props;
+ const pathCorrectionTest = /upload\_[a-z0-9]{32}.(.*)/g;
+ const matches = pathCorrectionTest.exec(url);
+ if (matches !== null) {
+ const properPath = Utils.prepend(`/files/pdfs/${matches[0]}`);
+ if (url !== properPath) {
+ Document[this.props.fieldKey] = new PdfField(properPath);
+ Document["oldPath"] = url;
+ }
+ }
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`);
this._coverPath = JSON.parse(await rp.get(path));
runInAction(() => this._showWaiting = this._showCover = true);