mirror of
https://github.com/strapi/strapi.git
synced 2025-11-14 17:19:01 +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.
|
* Remove them to have a clean URL instead to use as a filename.
|
||||||
*/
|
*/
|
||||||
function cleanUrl(url) {
|
function cleanUrl(url) {
|
||||||
// Break URL at ? and take first part (file name, extension)
|
return new URL(url).pathname.substring(1);
|
||||||
url = url.split('?')[0];
|
|
||||||
|
|
||||||
// Sometimes URL doesn't have ? but #
|
|
||||||
url = url.split('#')[0];
|
|
||||||
|
|
||||||
// Cleaned URL
|
|
||||||
return url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const urlsToAssets = async urls => {
|
export const urlsToAssets = async urls => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user