File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export class File extends Node {
1515 * Returns a clone of the file
1616 */
1717 clone ( ) : File {
18- return new File ( this . data )
18+ return new File ( this . _data , this . _knownDavService )
1919 }
2020
2121}
Original file line number Diff line number Diff line change 22 * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
5- import type { NodeData } from './nodeData'
65import { FileType } from './fileType'
76import { Node } from './node'
87
98export class Folder extends Node {
109
11- constructor ( data : NodeData ) {
10+ constructor ( ... [ data , davService ] : ConstructorParameters < typeof Node > ) {
1211 // enforcing mimes
1312 super ( {
1413 ...data ,
1514 mime : 'httpd/unix-directory' ,
16- } )
15+ } , davService )
1716 }
1817
1918 get type ( ) : FileType . Folder {
@@ -32,7 +31,7 @@ export class Folder extends Node {
3231 * Returns a clone of the folder
3332 */
3433 clone ( ) : Folder {
35- return new Folder ( this . data )
34+ return new Folder ( this . _data , this . _knownDavService )
3635 }
3736
3837}
Original file line number Diff line number Diff line change @@ -21,11 +21,14 @@ export enum NodeStatus {
2121 LOCKED = 'locked' ,
2222}
2323
24+ type NodeConstructorData = [ NodeData , RegExp ?]
25+
2426export abstract class Node {
2527
26- private _data : NodeData
2728 private _attributes : Attribute
28- private _knownDavService = / ( r e m o t e | p u b l i c ) \. p h p \/ ( w e b ) ? d a v / i
29+
30+ protected _data : NodeData
31+ protected _knownDavService = / ( r e m o t e | p u b l i c ) \. p h p \/ ( w e b ) ? d a v / i
2932
3033 private readonlyAttributes = Object . entries ( Object . getOwnPropertyDescriptors ( Node . prototype ) )
3134 . filter ( e => typeof e [ 1 ] . get === 'function' && e [ 0 ] !== '__proto__' )
@@ -58,7 +61,7 @@ export abstract class Node {
5861 } ,
5962 } as ProxyHandler < Attribute >
6063
61- constructor ( data : NodeData , davService ?: RegExp ) {
64+ constructor ( ... [ data , davService ] : NodeConstructorData ) {
6265 if ( ! data . mime ) {
6366 data . mime = 'application/octet-stream'
6467 }
@@ -346,13 +349,6 @@ export abstract class Node {
346349 this . _data . status = status
347350 }
348351
349- /**
350- * Get the node data
351- */
352- get data ( ) : NodeData {
353- return structuredClone ( this . _data )
354- }
355-
356352 /**
357353 * Move the node to a new destination
358354 *
You can’t perform that action at this time.
0 commit comments