File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
packages/ui/src/fields/Upload Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,15 @@ export function UploadComponentHasMany(props: Props) {
62
62
>
63
63
{ fileDocs . map ( ( { relationTo, value } , index ) => {
64
64
const id = String ( value . id )
65
+ const url : string = value . thumbnailURL || value . url
66
+ let src : string
67
+
68
+ try {
69
+ src = new URL ( url , serverURL ) . toString ( )
70
+ } catch {
71
+ src = `${ serverURL } ${ url } `
72
+ }
73
+
65
74
return (
66
75
< DraggableSortableItem disabled = { ! isSortable } id = { id } key = { id } >
67
76
{ ( draggableSortableItemProps ) => (
@@ -100,7 +109,7 @@ export function UploadComponentHasMany(props: Props) {
100
109
id = { id }
101
110
mimeType = { value ?. mimeType as string }
102
111
onRemove = { ( ) => removeItem ( index ) }
103
- src = { ` ${ serverURL } ${ value . url } ` }
112
+ src = { src }
104
113
withMeta = { false }
105
114
x = { value ?. width as number }
106
115
y = { value ?. height as number }
Original file line number Diff line number Diff line change @@ -26,6 +26,15 @@ export function UploadComponentHasOne(props: Props) {
26
26
const { relationTo, value } = fileDoc
27
27
const id = String ( value . id )
28
28
29
+ const url : string = value . thumbnailURL || value . url
30
+ let src : string
31
+
32
+ try {
33
+ src = new URL ( url , serverURL ) . toString ( )
34
+ } catch {
35
+ src = `${ serverURL } ${ url } `
36
+ }
37
+
29
38
return (
30
39
< UploadCard className = { [ baseClass , className ] . filter ( Boolean ) . join ( ' ' ) } >
31
40
< RelationshipContent
@@ -38,7 +47,7 @@ export function UploadComponentHasOne(props: Props) {
38
47
id = { id }
39
48
mimeType = { value ?. mimeType as string }
40
49
onRemove = { onRemove }
41
- src = { ` ${ serverURL } ${ value . url } ` }
50
+ src = { src }
42
51
x = { value ?. width as number }
43
52
y = { value ?. height as number }
44
53
/>
You can’t perform that action at this time.
0 commit comments