Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1109 from owncloud/processing
Browse files Browse the repository at this point in the history
introduce fileinfo processing state
  • Loading branch information
fschade committed Jul 5, 2022
2 parents 1a454f5 + ac5cd58 commit 6a91a93
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.DS_Store
.drone.yml
coverage
dist
docs
docs-swagger/node_modules
swagger.config.js
Expand Down
5 changes: 5 additions & 0 deletions changelog/unreleased/enhancement-add-resource-processing
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Resource processing

We've added a processing property to the fileinfo if the server response is `HTTP/1.1 425 TOO EARLY`

https://github.com/owncloud/owncloud-sdk/pull/1109
1 change: 1 addition & 0 deletions dist/owncloud.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions src/fileInfo.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
/**
* @class FileInfo
* @classdesc FileInfo class, stores information regarding a file/folder
* @param {string} name name of file/folder
* @param {string} type "file" => file ; "dir" => folder
* @param {string} attr attributes of file like size, time added etc.
* @param {string} name name of file/folder
* @param {string} type "file" => file ; "dir" => folder
* @param {string} attr attributes of file like size, time added etc.
* @param {boolean} processing
*/
class FileInfo {
constructor (name, type, attr) {
constructor (name, type, attr, processing = false) {
this.name = name
this.type = type
this.type = type
this.processing = processing
this.fileInfo = {}
this.tusSupport = null

Expand Down
13 changes: 11 additions & 2 deletions src/helperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,16 @@ class helpers {
}
const name = path

if (response.propStat.length === 0 || response.propStat[0].status !== 'HTTP/1.1 200 OK') {
if (response.propStat.length === 0) {
return null
}

const ok = response.propStat[0].status === 'HTTP/1.1 200 OK'
const processing = response.propStat[0].status === 'HTTP/1.1 425 TOO EARLY'

const cont = ok || processing

if (!cont) {
return null
}

Expand All @@ -596,7 +605,7 @@ class helpers {
}
}

return new FileInfo(name, fileType, props)
return new FileInfo(name, fileType, props, processing)
}

_parseTusHeaders (response) {
Expand Down

0 comments on commit 6a91a93

Please sign in to comment.