Skip to content

Commit

Permalink
Merge pull request #844 from 200ok-ch/refactor/dirName
Browse files Browse the repository at this point in the history
refactor: `dirName` function
  • Loading branch information
branch14 authored Jun 15, 2022
2 parents a9d3eae + ddcb9d6 commit a78118b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/actions/sync_backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { createGitlabOAuth } from '../sync_backend_clients/gitlab_sync_backend_c

import { addSeconds } from 'date-fns';

import pathParse from 'path-parse';

export const signOut = () => (dispatch, getState) => {
switch (getState().syncBackend.get('client', {}).type) {
case 'WebDAV':
Expand Down Expand Up @@ -132,7 +134,7 @@ export const downloadFile = (path) => {
* @param {String} path Returns the directory name of `path`.
*/
function dirName(path) {
return path.substring(0, path.lastIndexOf('/') + 1);
return pathParse(path).dir;
}

export const createFile = (path, content) => {
Expand Down

0 comments on commit a78118b

Please sign in to comment.