File tree Expand file tree Collapse file tree
packages/payload/src/uploads/endpoints Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ export const getFileFromURLHandler: PayloadHandler = async (req) => {
2121
2222 const config = collection ?. config
2323
24+ if ( ! config . upload ?. pasteURL ) {
25+ throw new APIError ( 'Pasting from URL is not enabled for this collection.' , 400 )
26+ }
27+
2428 if ( id ) {
2529 // updating doc
2630 const accessResult = await executeAccess ( { req } , config . access . update )
@@ -48,10 +52,7 @@ export const getFileFromURLHandler: PayloadHandler = async (req) => {
4852
4953 const validatedUrl = new URL ( src )
5054
51- if (
52- typeof config . upload ?. pasteURL === 'object' &&
53- ! isURLAllowed ( validatedUrl . href , config . upload . pasteURL . allowList )
54- ) {
55+ if ( ! isURLAllowed ( validatedUrl . href , config . upload . pasteURL . allowList ) ) {
5556 throw new APIError ( `The provided URL (${ validatedUrl . href } ) is not allowed.` , 400 )
5657 }
5758
You can’t perform that action at this time.
0 commit comments