aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSubView.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-03-17 16:12:49 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-03-17 16:12:49 -0400
commit1693e9daf1657c1fc45afa3fa14f0a0df0e01e13 (patch)
treec2e6fef9962d04998460279e7fd92d852bfe312c /src/client/views/collections/CollectionSubView.tsx
parent43580a656b88b287f3c62528fb51513e0ee65f6e (diff)
fixes for typing url in web box. fixes for dropping imags from proxied document. possible fix for updateing image width/height
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
-rw-r--r--src/client/views/collections/CollectionSubView.tsx12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index b995fc7d5..2d6777a4e 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -234,7 +234,9 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {
if (!html.startsWith("<a")) {
const tags = html.split("<");
if (tags[0] === "") tags.splice(0, 1);
- const img = tags[0].startsWith("img") ? tags[0] : tags.length > 1 && tags[1].startsWith("img") ? tags[1] : "";
+ let img = tags[0].startsWith("img") ? tags[0] : tags.length > 1 && tags[1].startsWith("img") ? tags[1] : "";
+ const cors = img.includes("corsProxy") ? img.match(/http.*corsProxy\//)![0] : "";
+ img = cors ? img.replace(cors, "") : img;
if (img) {
const split = img.split("src=\"")[1].split("\"")[0];
let source = split;
@@ -242,9 +244,11 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {
const [{ accessPaths }] = await Networking.PostToServer("/uploadRemoteImage", { sources: [split] });
source = Utils.prepend(accessPaths.agnostic.client);
}
- const doc = Docs.Create.ImageDocument(source, { ...options, _width: 300 });
- ImageUtils.ExtractExif(doc);
- addDocument(doc);
+ if (source.startsWith("http")) {
+ const doc = Docs.Create.ImageDocument(source, { ...options, _width: 300 });
+ ImageUtils.ExtractExif(doc);
+ addDocument(doc);
+ }
return;
} else {
const path = window.location.origin + "/doc/";