Skip to content

Commit

Permalink
Merge pull request #3041 from owncloud/replace-join-path-with-path
Browse files Browse the repository at this point in the history
Replace join-path usages with the path library
  • Loading branch information
Vincent Petry authored Feb 20, 2020
2 parents 3c79fcc + 4e2586c commit 1c90c16
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 220 deletions.
15 changes: 8 additions & 7 deletions apps/files/src/components/FilesAppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ import FileDrop from './FileDrop.vue'
import { mapActions, mapGetters, mapState } from 'vuex'
import Mixins from '../mixins'
import FileActions from '../fileactions'
import join from 'join-path'
import pathUtil from 'path'
export default {
components: {
Expand Down Expand Up @@ -273,7 +273,7 @@ export default {
for (let i = startIndex; i < pathSplit.length; i++) {
let clickHandler = null
let itemPath = baseUrl + encodeURIComponent(pathSplit.slice(0, i + 1).join('/'))
let itemPath = baseUrl + encodeURIComponent(pathUtil.join.apply(null, pathSplit.slice(0, i + 1)))
if (i === pathSplit.length - 1) {
itemPath = null
clickHandler = () => this.$router.go()
Expand Down Expand Up @@ -432,9 +432,10 @@ export default {
if (fileName !== '') {
this.fileFolderCreationLoading = true
const path = this.item === '' ? (this.configuration.rootFolder ? `${this.configuration.rootFolder}/` : '/') : `${this.item}/`
let p = this.$client.files.putFileContents(path + fileName, '')
const filePath = pathUtil.join(path, fileName)
let p = this.$client.files.putFileContents(filePath, '')
if (this.publicPage()) {
p = this.$client.publicFiles.putFileContents(path + fileName, null, this.publicLinkPassword, '')
p = this.$client.publicFiles.putFileContents(filePath, null, this.publicLinkPassword, '')
}
p.then(() => {
this.createFile = false
Expand All @@ -444,9 +445,9 @@ export default {
// not cool - needs refactoring
this.$nextTick(() => {
this.openFile({
filePath: path + fileName
filePath: filePath
})
this.openFileAction(this.newFileAction, path + fileName)
this.openFileAction(this.newFileAction, filePath)
})
}
})
Expand Down Expand Up @@ -496,7 +497,7 @@ export default {
}
this.$nextTick().then(() => {
const path = this.item === '' ? (this.configuration.rootFolder ? `${this.configuration.rootFolder}/` : '/') : `${this.item}/`
const filePath = join(path + file)
const filePath = pathUtil.join(path, file)
if (this.publicPage()) {
this.$client.publicFiles.list(filePath, this.publicLinkPassword, this.davProperties, '0').then(files => {
this.addFiles({
Expand Down
8 changes: 4 additions & 4 deletions apps/files/src/mixins.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import filesize from 'filesize'
import join from 'join-path'
import pathUtil from 'path'
import moment from 'moment'
import fileTypeIconMappings from './fileTypeIconMappings.json'
import { mapActions, mapGetters } from 'vuex'
Expand Down Expand Up @@ -237,7 +237,7 @@ export default {
continue
}

const parentDirectory = directories.slice(0, i).join('/')
const parentDirectory = pathUtil.join.apply(null, directories.slice(0, i))
const currentDirectory = `${parentDirectory}/${directories[i]}`

if (directoriesToCreate.indexOf(currentDirectory) === -1) {
Expand Down Expand Up @@ -311,7 +311,7 @@ export default {
const tokenSplit = basePath.indexOf('/')
const token = basePath.substr(0, tokenSplit)
basePath = basePath.substr(tokenSplit + 1) || ''
relativePath = join(basePath, relativePath)
relativePath = pathUtil.join(basePath, relativePath)
promise = this.uploadQueue.add(() => this.$client.publicFiles.putFileContents(token, relativePath, this.publicLinkPassword, file, {
onProgress: (progress) => {
this.$_ocUpload_onProgress(progress, file)
Expand All @@ -320,7 +320,7 @@ export default {
}))
} else {
basePath = this.path || ''
relativePath = join(basePath, relativePath)
relativePath = pathUtil.join(basePath, relativePath)
promise = this.uploadQueue.add(() => this.$client.files.putFileContents(relativePath, file, {
onProgress: (progress) => {
this.$_ocUpload_onProgress(progress, file)
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"html-webpack-plugin": "^3.2.0",
"husky": ">=3.0.5",
"inert-polyfill": "^0.2.5",
"path": "^0.12.7",
"join-path": "^1.1.1",
"lint-staged": ">=9",
"lodash": "^4.17.15",
Expand Down Expand Up @@ -126,8 +127,5 @@
"yarn lint --fix",
"git add"
]
},
"dependencies": {
"path": "^0.12.7"
}
}
Loading

0 comments on commit 1c90c16

Please sign in to comment.