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

introduce fileinfo processing state #1188

Merged
merged 1 commit into from
Dec 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
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