diff options
author | geireann <geireann.lindfield@gmail.com> | 2023-08-23 23:25:49 -0400 |
---|---|---|
committer | geireann <geireann.lindfield@gmail.com> | 2023-08-23 23:25:49 -0400 |
commit | 1a87cabca08f8919539644c439f38a9da9f7815e (patch) | |
tree | d5a2d9d15c176c4b702ec5f4bc67caf91a059a63 /src/client/views/nodes/ImageBox.tsx | |
parent | b3dbdb5e20dfafe62e03c336d3137775ca0a57cb (diff) |
protecting against bad urls especially after generating thumbnails
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
-rw-r--r-- | src/client/views/nodes/ImageBox.tsx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 44da98f75..6595689f7 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -287,10 +287,11 @@ export class ImageBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProp @computed private get url() { const data = Cast(this.dataDoc[this.fieldKey], ImageField); - return data ? data.url.href : undefined; + return data ? data.url?.href : undefined; } choosePath(url: URL) { + if (!url?.href) return ""; const lower = url.href.toLowerCase(); if (url.protocol === 'data') return url.href; if (url.href.indexOf(window.location.origin) === -1 && url.href.indexOf('dashblobstore') === -1) return Utils.CorsProxy(url.href); @@ -318,7 +319,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProp if (!(data instanceof ImageField)) { return null; } - const primary = data.url.href; + const primary = data.url?.href; if (primary.includes(window.location.origin)) { return null; } |