aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-12-13 15:36:16 -0500
committerSam Wilkins <samwilkins333@gmail.com>2019-12-13 15:36:16 -0500
commitd4f793d73070594086c72cf67a8b2b0a60b2af77 (patch)
tree05defe99068bfcd2bc32f2b9e600a9f3a39645d3
parentf49cf16cb4af2851aaa98bb2c6fce81271042fea (diff)
write to data doc + console logs for pdf fix
-rw-r--r--src/client/views/pdf/PDFViewer.tsx13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 4716e9d66..253968443 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -126,15 +126,24 @@ 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 backup = "oldPath";
const { url, Document } = this.props;
const pathCorrectionTest = /upload\_[a-z0-9]{32}.(.*)/g;
const matches = pathCorrectionTest.exec(url);
+ console.log("\nHere's the { url } being fed into the outer regex:");
+ console.log(url);
+ console.log("And here's the 'properPath' build from the captured filename:\n");
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 (url !== properPath) {
- Document[this.props.fieldKey] = new PdfField(properPath);
- Document["oldPath"] = url;
+ const proto = Doc.GetProto(Document);
+ proto[this.props.fieldKey] = new PdfField(properPath);
+ proto[backup] = url;
}
+ } 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`);
this._coverPath = JSON.parse(await rp.get(path));