Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/models/davCollectionPublishable.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import * as XMLUtility from '../utility/xmlUtility.js'
import { debugFactory } from '../debug.js'
const debug = debugFactory('DavCollectionPublishable')

/**
*
* @param Base
*/
export function davCollectionPublishable(Base) {
return class extends Base {

Expand Down
4 changes: 4 additions & 0 deletions src/models/davCollectionShareable.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import * as XMLUtility from '../utility/xmlUtility.js'
import { debugFactory } from '../debug.js'
const debug = debugFactory('DavCollectionShareable')

/**
*
* @param Base
*/
export function davCollectionShareable(Base) {
return class extends Base {

Expand Down
2 changes: 2 additions & 0 deletions src/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ export default class Request {
/**
* returns name of file / folder of a url
*
* @param url
* @params {string} url
* @return {string}
*/
Expand All @@ -352,6 +353,7 @@ export default class Request {
/**
* returns pathname for a URL
*
* @param url
* @params {string} url
* @return {string}
*/
Expand Down
3 changes: 3 additions & 0 deletions src/utility/stringUtility.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
*/

// uuidv4 taken from https://stackoverflow.com/a/2117523
/**
*
*/
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8)
Expand Down
14 changes: 14 additions & 0 deletions src/utility/xmlUtility.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ export function serialize(json) {
return serializer.serializeToString(root)
}

/**
*
* @param xmlDoc
* @param parent
* @param json
*/
function xmlify(xmlDoc, parent, json) {
const [ns, localName] = json.name
const element = xmlDoc.createElementNS(ns, getPrefixedNameForNamespace(ns, localName))
Expand All @@ -85,10 +91,18 @@ function xmlify(xmlDoc, parent, json) {
parent.appendChild(element)
}

/**
*
*/
export function resetPrefixMap() {
prefixMap = {}
}

/**
*
* @param ns
* @param localName
*/
function getPrefixedNameForNamespace(ns, localName) {
if (!Object.prototype.hasOwnProperty.call(prefixMap, ns)) {
prefixMap[ns] = 'x' + Object.keys(prefixMap).length
Expand Down
Loading