The function basename is currently being used to extract the file name from a URL when importing files from external sources. However, using basename may not always yield accurate file names, especially if the file name is specified in the Content-Dispositionheader of the HTTP response, which is common in file downloads.
Ideal solution
The create function should retrieve the file name from a URL by first attempting to read the Content-Disposition header. If this header is not available, the function should fall back to using basename.
Context and motivation
The function
basename
is currently being used to extract the file name from a URL when importing files from external sources. However, usingbasename
may not always yield accurate file names, especially if the file name is specified in theContent-Disposition
header of the HTTP response, which is common in file downloads.Ideal solution
The create function should retrieve the file name from a URL by first attempting to read the
Content-Disposition
header. If this header is not available, the function should fall back to usingbasename
.