mirror of
https://github.com/plankanban/planka.git
synced 2025-12-25 17:25:01 +03:00
ref: Little refactoring
This commit is contained in:
16
client/src/utils/get-filename-and-extension.js
Normal file
16
client/src/utils/get-filename-and-extension.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
export default (url) => {
|
||||
const filename = url.split('/').pop().toLowerCase();
|
||||
|
||||
let extension = filename.slice((Math.max(0, filename.lastIndexOf('.')) || Infinity) + 1);
|
||||
extension = extension ? extension.toLowerCase() : null;
|
||||
|
||||
return {
|
||||
filename,
|
||||
extension,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user