Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/prevent-whitespace-at-the-end-of-name
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Hirt authored Jul 5, 2019
2 parents a54f935 + e792e7c commit 9fa15f3
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 32 deletions.
14 changes: 14 additions & 0 deletions apps/files/.snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.5
ignore: {}
# patches apply the minimum changes required to fix a vulnerability
patch:
SNYK-JS-LODASH-450202:
- babel-eslint > @babel/traverse > lodash:
patched: '2019-07-04T06:36:45.449Z'
- babel-eslint > @babel/traverse > @babel/generator > lodash:
patched: '2019-07-04T06:36:45.449Z'
- babel-eslint > @babel/traverse > @babel/helper-split-export-declaration > @babel/types > lodash:
patched: '2019-07-04T06:36:45.449Z'
- babel-eslint > @babel/traverse > @babel/helper-function-name > @babel/template > @babel/types > lodash:
patched: '2019-07-04T06:36:45.449Z'
10 changes: 7 additions & 3 deletions apps/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"main": "js/files.bundle.js",
"scripts": {
"watch": "webpack --progress --colors --watch --mode development --config webpack.dev.js",
"build": "webpack -p --config webpack.common.js --debug"
"build": "webpack -p --config webpack.common.js --debug",
"snyk-protect": "snyk protect",
"prepublish": "npm run snyk-protect"
},
"author": "Felix Heidecke",
"license": "AGPL-3.0",
Expand Down Expand Up @@ -42,11 +44,13 @@
"babel-eslint": "^10.0.2",
"filesize": "^4.1.2",
"moment": "^2.24.0",
"vuex": "^3.1.1"
"vuex": "^3.1.1",
"snyk": "^1.189.0"
},
"browserslist": [
"last 1 version",
"> 1%",
"IE 11"
]
],
"snyk": true
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"easygettext": "^2.7.0",
"eslint": "<6.0.0",
"eslint-config-standard": "^12.0.0",
"eslint-loader": "^2.1.2",
"eslint-loader": "^2.2.0",
"eslint-plugin-compat": "^3.2.0",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-node": "^9.1.0",
Expand All @@ -69,7 +69,7 @@
"npm-run-all": "^4.1.5",
"oidc-client": "^1.8.2",
"owncloud-design-system": "^1.0.0-807",
"owncloud-sdk": "1.0.0-204",
"owncloud-sdk": "1.0.0-217",
"parse-json": "^4.0.0",
"requirejs": "^2.3.6",
"rimraf": "^2.6.3",
Expand Down
3 changes: 1 addition & 2 deletions src/store/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ const mutations = {
state.messages.push(message)
},
REMOVE_MESSAGE (state, item) {
let index = state.notifications.indexOf(item)
state.notifications.splice(index, 1)
state.messages.splice(state.messages.indexOf(item), 1)
},
LOADING_NOTIFICATIONS (state, loading) {
state.notifications.loading = loading
Expand Down
13 changes: 6 additions & 7 deletions tests/acceptance/features/webUIFavorites/favoritesFile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ Feature: Mark file as favorite
When the user browses to the files page using the webUI
Then there should be 31 files/folders listed on the webUI

@issue-1194
@skip @yetToImplement
Scenario: mark files with same name and different path as favorites and list them in favourites page
When the user marks file "lorem.txt" as favorite using the webUI
And the user marks folder "simple-empty-folder" as favorite using the webUI
Expand All @@ -69,8 +67,9 @@ Feature: Mark file as favorite
And the user browses to the files page
And the user opens folder "strängé नेपाली folder" using the webUI
And the user marks file "lorem.txt" as favorite using the webUI
Then file "lorem.txt" with path "/" should be listed in the favorites page on the webUI
And file "lorem.txt" with path "/simple-folder" should be listed in the favorites page on the webUI
And folder "simple-empty-folder" with path "/" should be listed in the favorites page on the webUI
And file "simple-empty-folder" with path "/simple-folder" should be listed in the favorites page on the webUI
And file "lorem.txt" with path "/strängé नेपाली folder" should be listed in the favorites page on the webUI
When the user browses to the favorites page
Then file "lorem.txt" should be listed on the webUI
And file "simple-folder/lorem.txt" should be listed on the webUI
And folder "simple-empty-folder" should be listed on the webUI
And folder "simple-folder/simple-empty-folder" should be listed on the webUI
And file "strängé नेपाली folder/lorem.txt" should be listed on the webUI
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Feature: create folder
| 'सिमप्ले फोल्देर $%#?&@' |
| '"somequotes1"' |
| "'somequotes2'" |
| "\"quote\"d-folders'" |
| "^#29][29@({" |
| "+-{$(882)" |
| "home" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Feature: rename files
| "simple-name.txt" |
| "लोरेम।तयक्स्त? $%#&@" |
| '"quotes1"' |
| "\"quote\"d-folders'" |
| "'quotes2'" |

Scenario Outline: Rename a file that has special characters in its name
Expand Down
28 changes: 28 additions & 0 deletions tests/acceptance/helpers/xpath.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
/**
* Returns an XPath string literal to use for searching values inside
* element/attribute.
*
* This wraps them in single quotes, double quotes, or as a concat function,
* as xpath expressions can contain single or double quotes but not both.
* Also, xpath does not support escaping.
*
* {@link https://stackoverflow.com/q/1341847 Special Character in XPATH Query}
* {@link https://stackoverflow.com/q/642125 Encoding XPath Expressions with both single and double quotes}
*
* @param {string} value
* @returns {string}
*/
buildXpathLiteral: function (value) {
if (!value.includes("'")) {
// if we don't have any single quotes, then wrap them with single quotes
return "'" + value + "'"
} else if (!value.includes('"')) {
// if we don't have any double quotes, then wrap them with double quotes
return '"' + value + '"'
} else {
// use concat to find the literal in the xpath if they contain both quotes
return "concat('" + value.replace("'", "',\"'\",'") + "')"
}
}
}
27 changes: 21 additions & 6 deletions tests/acceptance/pageObjects/FilesPageElement/filesList.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const util = require('util')
const path = require('path')
const xpathHelper = require('../../helpers/xpath')

module.exports = {
commands: {
/**
Expand Down Expand Up @@ -166,12 +170,20 @@ module.exports = {
* @returns {string}
*/
getFileRowSelectorByFileName: function (fileName) {
var element = this.elements['fileRowByName']
var util = require('util')
if (fileName.indexOf('"') > -1) {
element.selector = element.selector.replace(/"/g, "'")
const parts = path.parse(fileName)
if (parts.ext) {
// keep path of nested folders intact, just remove the extension at the end
let filePathWithoutExt = parts.dir ? parts.dir + '/' + parts.name : parts.name
const element = this.elements['fileRowByNameAndExtension']
return util.format(
element.selector,
xpathHelper.buildXpathLiteral(filePathWithoutExt),
parts.ext
)
}
return util.format(element.selector, fileName)

const element = this.elements['fileRowByName']
return util.format(element.selector, xpathHelper.buildXpathLiteral(fileName))
},
/**
*
Expand Down Expand Up @@ -252,7 +264,10 @@ module.exports = {
selector: '#oc-dialog-rename-confirm'
},
fileRowByName: {
selector: '//span[contains(@class, "file-row-name")][@filename="%s"]/../..'
selector: '//span[@class="oc-file-name"][text()=%s and not(../span[@class="oc-file-extension"])]/../../..'
},
fileRowByNameAndExtension: {
selector: '//span[span/text()=%s and span/text()="%s"]/../..'
},
fileLinkInFileRow: {
selector: '//span[contains(@class, "file-row-name")]'
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ When('the user reloads the current page of the webUI', function () {

Then('these folders/files should not be listed on the webUI', function (entryList) {
entryList.rows().forEach(entry => {
client.page.FilesPageElement.filesList().assertElementNotListed(entry)
client.page.FilesPageElement.filesList().assertElementNotListed(entry[0])
})
return client
})
Expand Down
23 changes: 12 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2559,9 +2559,10 @@ date-now@^0.1.4:
resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"
integrity sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=

"davclient.js@https://github.com/owncloud/davclient.js.git":
"davclient.js@git+https://github.com/owncloud/davclient.js.git":
version "0.1.3"
resolved "https://github.com/owncloud/davclient.js.git#07237a4bb813eb19e19e322e2457ce216721d529"
uid "07237a4bb813eb19e19e322e2457ce216721d529"
resolved "git+https://github.com/owncloud/davclient.js.git#07237a4bb813eb19e19e322e2457ce216721d529"

de-indent@^1.0.2:
version "1.0.2"
Expand Down Expand Up @@ -3124,10 +3125,10 @@ eslint-import-resolver-node@^0.3.2:
debug "^2.6.9"
resolve "^1.5.0"

eslint-loader@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-2.1.2.tgz#453542a1230d6ffac90e4e7cb9cadba9d851be68"
integrity sha512-rA9XiXEOilLYPOIInvVH5S/hYfyTPyxag6DZhoQOduM+3TkghAEQ3VcFO8VnX4J4qg/UIBzp72aOf/xvYmpmsg==
eslint-loader@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-2.2.0.tgz#e2322b46fc5584ebbffd13c78089cd27d63565a9"
integrity sha512-O7zOQw6HS1t8H08O8DsAXPccSIu3xduku/aqdjQwPHp/NzIT/nwwkq+Ly5EtGfXo931/yTwiCuB9kjg/0D2sTg==
dependencies:
loader-fs-cache "^1.0.0"
loader-utils "^1.0.2"
Expand Down Expand Up @@ -6214,13 +6215,13 @@ owncloud-design-system@^1.0.0-807:
vuex "^3.1.1"
webfontloader "^1.6.28"

owncloud-sdk@1.0.0-204:
version "1.0.0-204"
resolved "https://registry.yarnpkg.com/owncloud-sdk/-/owncloud-sdk-1.0.0-204.tgz#e01b2bf936961b898877c77614c00a775bd97126"
integrity sha512-hTP68ZAKDfMsa5aKLAqYlcmz+GU8ab/H+adqjXJc9ngH/5h3dWG7tLUAbyiyiQsnmpqKYEpjQJrEnxnaXy1XrQ==
owncloud-sdk@1.0.0-217:
version "1.0.0-217"
resolved "https://registry.yarnpkg.com/owncloud-sdk/-/owncloud-sdk-1.0.0-217.tgz#f2c7de58c1ab213680392254a33d49a9137a4919"
integrity sha512-u//66vRmVdEFi8GS5qxmvmg2lHMfrg670KgaGx0n2o7oPfQqtvLjYvoaAB2xi/DlBUj00CFDPdg7FlMdWdAN7g==
dependencies:
browser-request "^0.3.3"
davclient.js "https://github.com/owncloud/davclient.js.git"
davclient.js "git+https://github.com/owncloud/davclient.js.git"
promise "^8.0.3"
request "^2.88.0"
utf8 "^3.0.0"
Expand Down

0 comments on commit 9fa15f3

Please sign in to comment.