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

introduce fileinfo processing state #1109

Merged
merged 1 commit into from
Jul 5, 2022
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: 2 additions & 2 deletions .drone.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# The version of OCIS to use in pipelines that test against OCIS
OCIS_COMMITID=4abe656dcdb34638229fdfbb3d4bedf9f8148e0e
OCIS_BRANCH=master
OCIS_COMMITID=70c3499499793923b072f2bdc2826f2d20672d87
OCIS_BRANCH=experimental
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