aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/apis/google_docs/GoogleApiClientUtils.ts2
-rw-r--r--src/client/util/RichTextSchema.tsx2
-rw-r--r--src/new_fields/RichTextUtils.ts6
-rw-r--r--src/server/ApiManagers/GooglePhotosManager.ts2
-rw-r--r--src/server/DashUploadUtils.ts4
5 files changed, 9 insertions, 7 deletions
diff --git a/src/client/apis/google_docs/GoogleApiClientUtils.ts b/src/client/apis/google_docs/GoogleApiClientUtils.ts
index d2a79f189..0d44ee8e0 100644
--- a/src/client/apis/google_docs/GoogleApiClientUtils.ts
+++ b/src/client/apis/google_docs/GoogleApiClientUtils.ts
@@ -248,7 +248,7 @@ export namespace GoogleApiClientUtils {
return undefined;
}
requests.push(...options.content.requests);
- const replies: any = await update({ documentId: documentId, requests });
+ const replies: any = await update({ documentId, requests });
if ("errors" in replies) {
console.log("Write operation failed:");
console.log(replies.errors.map((error: any) => error.message));
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index 269a045a0..f12b3632c 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -883,7 +883,7 @@ export class DashFieldView {
e.stopPropagation();
if ((e.key === "a" && e.ctrlKey) || (e.key === "a" && e.metaKey)) {
if (window.getSelection) {
- var range = document.createRange();
+ const range = document.createRange();
range.selectNodeContents(self._fieldSpan);
window.getSelection()!.removeAllRanges();
window.getSelection()!.addRange(range);
diff --git a/src/new_fields/RichTextUtils.ts b/src/new_fields/RichTextUtils.ts
index 2fedac53e..016bcc4ca 100644
--- a/src/new_fields/RichTextUtils.ts
+++ b/src/new_fields/RichTextUtils.ts
@@ -1,5 +1,5 @@
import { EditorState, Transaction, TextSelection } from "prosemirror-state";
-import { Node, Fragment, Mark, MarkType } from "prosemirror-model";
+import { Node, Fragment, Mark } from "prosemirror-model";
import { RichTextField } from "./RichTextField";
import { docs_v1 } from "googleapis";
import { GoogleApiClientUtils } from "../client/apis/google_docs/GoogleApiClientUtils";
@@ -17,6 +17,7 @@ import { Id } from "./FieldSymbols";
import { DocumentView } from "../client/views/nodes/DocumentView";
import { AssertionError } from "assert";
import { Networking } from "../client/Network";
+import { extname } from "path";
export namespace RichTextUtils {
@@ -138,7 +139,8 @@ export namespace RichTextUtils {
const embeddedObject = object.inlineObjectProperties!.embeddedObject!;
const size = embeddedObject.size!;
const width = size.width!.magnitude!;
- const url = Utils.prepend(clientAccessPath);
+ const ext = extname(clientAccessPath);
+ const url = Utils.prepend(clientAccessPath.replace(ext, "_m" + ext));
inlineObjectMap.set(object.objectId!, {
title: embeddedObject.title || `Imported Image from ${document.title}`,
diff --git a/src/server/ApiManagers/GooglePhotosManager.ts b/src/server/ApiManagers/GooglePhotosManager.ts
index 157f6bdca..3236d1ee2 100644
--- a/src/server/ApiManagers/GooglePhotosManager.ts
+++ b/src/server/ApiManagers/GooglePhotosManager.ts
@@ -95,7 +95,7 @@ export default class GooglePhotosManager extends ApiManager {
const { contentSize, ...attributes } = results;
const found: Opt<DashUploadUtils.ImageUploadInformation> = await Database.Auxiliary.QueryUploadHistory(contentSize);
if (!found) {
- const upload = await DashUploadUtils.UploadInspectedImage({ contentSize, ...attributes }, undefined, prefix).catch(error => _error(res, downloadError, error));
+ const upload = await DashUploadUtils.UploadInspectedImage({ contentSize, ...attributes }, undefined, prefix, false).catch(error => _error(res, downloadError, error));
if (upload) {
completed.push(upload);
await Database.Auxiliary.LogUpload(upload);
diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts
index 4e6bbaa3f..83a0064e8 100644
--- a/src/server/DashUploadUtils.ts
+++ b/src/server/DashUploadUtils.ts
@@ -223,7 +223,7 @@ export namespace DashUploadUtils {
});
}
- export const UploadInspectedImage = async (metadata: InspectionResults, filename?: string, prefix = ""): Promise<ImageUploadInformation> => {
+ export const UploadInspectedImage = async (metadata: InspectionResults, filename?: string, prefix = "", cleanUp = true): Promise<ImageUploadInformation> => {
const { requestable, source, ...remaining } = metadata;
const extension = `.${remaining.contentType.split("/")[1].toLowerCase()}`;
const resolved = filename || `${prefix}upload_${Utils.GenerateGuid()}${extension}`;
@@ -237,7 +237,7 @@ export namespace DashUploadUtils {
for (const suffix of Object.keys(writtenFiles)) {
information.serverAccessPaths[suffix] = serverPathToFile(Directory.images, writtenFiles[suffix]);
}
- if (isLocal().test(source)) {
+ if (isLocal().test(source) && cleanUp) {
unlinkSync(source);
}
return information;