aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 12b57351d..279916bac 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -61,7 +61,6 @@ import { DashWebRTCVideo } from "../views/webcam/DashWebRTCVideo";
import { DocumentType } from "./DocumentTypes";
import { IconProp } from "@fortawesome/fontawesome-svg-core";
import { MapBox } from "../views/nodes/MapBox/MapBox";
-const path = require('path');
const defaultNativeImageDim = Number(DFLT_IMAGE_NATIVE_DIM.replace("px", ""));
class EmptyBox {
@@ -663,7 +662,7 @@ export namespace Docs {
export function ImageDocument(url: string, options: DocumentOptions = {}) {
const imgField = new ImageField(url);
- return InstanceFromProto(Prototypes.get(DocumentType.IMG), imgField, { title: path.basename(url), ...options });
+ return InstanceFromProto(Prototypes.get(DocumentType.IMG), imgField, { title: url.replace(/.*\//, "") /* path.basename(url)*/, ...options });
}
export function PresDocument(initial: List<Doc> = new List(), options: DocumentOptions = {}) {
@@ -1480,14 +1479,14 @@ export namespace DocUtils {
export async function uploadYoutubeVideo(videoId: string, options: DocumentOptions) {
const generatedDocuments: Doc[] = [];
for (const { source: { name, type }, result } of await Networking.UploadYoutubeToServer(videoId)) {
- processFileupload(generatedDocuments, name, type, result, options);
+ name && type && processFileupload(generatedDocuments, name, type, result, options);
}
return generatedDocuments;
}
export async function uploadFilesToDocs(files: File[], options: DocumentOptions) {
const generatedDocuments: Doc[] = [];
for (const { source: { name, type }, result } of await Networking.UploadFilesToServer(files)) {
- processFileupload(generatedDocuments, name, type, result, options);
+ name && type && processFileupload(generatedDocuments, name, type, result, options);
}
return generatedDocuments;
}