mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
refactor clean url
This commit is contained in:
parent
fce7a9112a
commit
10ea1e4ea2
@ -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 => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user