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

Commit

Permalink
introduce fileinfo processing state
Browse files Browse the repository at this point in the history
  • Loading branch information
fschade authored and kulmann committed Dec 5, 2022
1 parent 06d40eb commit b367aac
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/enhancement-add-resource-processing
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
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
https://github.com/owncloud/owncloud-sdk/pull/1188
10 changes: 6 additions & 4 deletions src/fileInfo.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/**
* @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 state of the file
*/
class FileInfo {
constructor (name, type, attr) {
constructor (name, type, attr, processing = false) {
this.name = name
this.type = type
this.processing = processing
this.fileInfo = {}
this.tusSupport = null

Expand Down
11 changes: 9 additions & 2 deletions src/helperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,14 @@ 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'

if (!ok && !processing) {
return null
}

Expand All @@ -599,7 +606,7 @@ class helpers {
}
}

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

_parseTusHeaders (response) {
Expand Down

0 comments on commit b367aac

Please sign in to comment.