diff options
Diffstat (limited to 'apps/files/src/utils/fileUtils.js')
-rw-r--r-- | apps/files/src/utils/fileUtils.js | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/apps/files/src/utils/fileUtils.js b/apps/files/src/utils/fileUtils.js deleted file mode 100644 index 5ab88c6eb63..00000000000 --- a/apps/files/src/utils/fileUtils.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com> - * - * @author John Molakvoæ <skjnldsv@protonmail.com> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -const encodeFilePath = function(path) { - const pathSections = (path.startsWith('/') ? path : `/${path}`).split('/') - let relativePath = '' - pathSections.forEach((section) => { - if (section !== '') { - relativePath += '/' + encodeURIComponent(section) - } - }) - return relativePath -} - -/** - * Extract dir and name from file path - * - * @param {string} path the full path - * @return {string[]} [dirPath, fileName] - */ -const extractFilePaths = function(path) { - const pathSections = path.split('/') - const fileName = pathSections[pathSections.length - 1] - const dirPath = pathSections.slice(0, pathSections.length - 1).join('/') - return [dirPath, fileName] -} - -export { encodeFilePath, extractFilePaths } |