refactor clean url

This commit is contained in:
Marc-Roig 2022-08-09 11:43:54 +02:00
parent fce7a9112a
commit 10ea1e4ea2

View File

@ -7,14 +7,7 @@ import { typeFromMime } from './typeFromMime';
* Remove them to have a clean URL instead to use as a filename.
*/
function cleanUrl(url) {
// Break URL at ? and take first part (file name, extension)
url = url.split('?')[0];
// Sometimes URL doesn't have ? but #
url = url.split('#')[0];
// Cleaned URL
return url;
return new URL(url).pathname.substring(1);
}
export const urlsToAssets = async urls => {