diff --git a/packages/backend/src/api/filesystem/FlagParam.js b/packages/backend/src/api/filesystem/FlagParam.js index 1a688e11..3ba1b2b1 100644 --- a/packages/backend/src/api/filesystem/FlagParam.js +++ b/packages/backend/src/api/filesystem/FlagParam.js @@ -16,6 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ +const { APIError } = require('../../api/APIError'); + module.exports = class FlagParam { constructor (srckey, options) { this.srckey = srckey; diff --git a/packages/backend/src/api/filesystem/StringParam.js b/packages/backend/src/api/filesystem/StringParam.js index 674f2180..17e46231 100644 --- a/packages/backend/src/api/filesystem/StringParam.js +++ b/packages/backend/src/api/filesystem/StringParam.js @@ -16,6 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ +const { APIError } = require('../../api/APIError'); + module.exports = class StringParam { constructor (srckey, options) { this.srckey = srckey; diff --git a/packages/backend/src/filesystem/FilesystemService.js b/packages/backend/src/filesystem/FilesystemService.js index 3322e07f..959264d8 100644 --- a/packages/backend/src/filesystem/FilesystemService.js +++ b/packages/backend/src/filesystem/FilesystemService.js @@ -138,7 +138,6 @@ class FilesystemService extends AdvancedBase { return permission.startsWith('fs:'); }, checker: async (actor, permission) => { - debugger; if ( !(actor.type instanceof UserActorType) ) { return undefined; } @@ -363,7 +362,7 @@ class FilesystemService extends AdvancedBase { [new_path, old_path.length + 1, old_path + '%', user_id] ); - const log = services.get('log-service').create('update_child_paths'); + const log = this.services.get('log-service').create('update_child_paths'); log.info(`updated ${old_path} -> ${new_path}`); monitor.end(); diff --git a/packages/backend/src/filesystem/batch/BatchExecutor.js b/packages/backend/src/filesystem/batch/BatchExecutor.js index bf4e6562..6da8e00b 100644 --- a/packages/backend/src/filesystem/batch/BatchExecutor.js +++ b/packages/backend/src/filesystem/batch/BatchExecutor.js @@ -118,7 +118,7 @@ class BatchExecutor extends AdvancedBase { alarm: true, }); - e = APIError.adapt(e); + e = APIError.adapt(e); // eslint-disable-line no-ex-assign } // Consume stream if there's a file diff --git a/packages/backend/src/filesystem/hl_operations/hl_data_read.js b/packages/backend/src/filesystem/hl_operations/hl_data_read.js index a942fa34..e19e9530 100644 --- a/packages/backend/src/filesystem/hl_operations/hl_data_read.js +++ b/packages/backend/src/filesystem/hl_operations/hl_data_read.js @@ -18,6 +18,9 @@ */ const { stream_to_buffer } = require("../../util/streamutil"); const { HLFilesystemOperation } = require("./definitions"); +const { chkperm } = require('../../helpers'); +const { LLRead } = require('../ll_operations/ll_read'); +const { APIError } = require('../../api/APIError'); /** * HLDataRead reads a stream of objects from a file containing structured data. @@ -38,6 +41,7 @@ class HLDataRead extends HLFilesystemOperation { const { fsNode, + version_id, } = this.values; if ( ! await fsNode.exists() ) { @@ -85,6 +89,7 @@ class HLDataRead extends HLFilesystemOperation { } _stream_jsonl_lines_to_objects (stream) { + const { PassThrough } = this.modules.stream; const output_stream = new PassThrough(); (async () => { for await (const line of stream) { diff --git a/packages/backend/src/filesystem/hl_operations/hl_mkdir.js b/packages/backend/src/filesystem/hl_operations/hl_mkdir.js index 86f84ca7..7a369244 100644 --- a/packages/backend/src/filesystem/hl_operations/hl_mkdir.js +++ b/packages/backend/src/filesystem/hl_operations/hl_mkdir.js @@ -63,6 +63,7 @@ class MkTree extends HLFilesystemOperation { async _run () { const { values, context } = this; + const fs = context.get('services').get('filesystem'); await this.create_branch_({ parent_node: values.parent || await fs.node(new RootNodeSelector()), diff --git a/packages/backend/src/filesystem/hl_operations/hl_move.js b/packages/backend/src/filesystem/hl_operations/hl_move.js index a545f517..1fd4b801 100644 --- a/packages/backend/src/filesystem/hl_operations/hl_move.js +++ b/packages/backend/src/filesystem/hl_operations/hl_move.js @@ -17,7 +17,7 @@ * along with this program. If not, see . */ const APIError = require("../../api/APIError"); -const { chkperm, validate_fsentry_name, is_ancestor_of } = require("../../helpers"); +const { chkperm, validate_fsentry_name, is_ancestor_of, df, get_user } = require("../../helpers"); const { LLMove } = require("../ll_operations/ll_move"); const { RootNodeSelector } = require("../node/selectors"); const { HLFilesystemOperation } = require("./definitions"); diff --git a/packages/backend/src/filesystem/hl_operations/hl_read.js b/packages/backend/src/filesystem/hl_operations/hl_read.js index 130b974d..56de932a 100644 --- a/packages/backend/src/filesystem/hl_operations/hl_read.js +++ b/packages/backend/src/filesystem/hl_operations/hl_read.js @@ -41,7 +41,7 @@ class HLRead extends HLFilesystemOperation { } const ll_read = new LLRead(); - const stream = await ll_read.run({ + let stream = await ll_read.run({ fsNode, actor, version_id, ...(byte_count !== undefined ? { diff --git a/packages/backend/src/filesystem/hl_operations/hl_stat.js b/packages/backend/src/filesystem/hl_operations/hl_stat.js index ed5d21f1..a8ea07a3 100644 --- a/packages/backend/src/filesystem/hl_operations/hl_stat.js +++ b/packages/backend/src/filesystem/hl_operations/hl_stat.js @@ -19,6 +19,7 @@ const { chkperm } = require("../../helpers"); const { Context } = require("../../util/context"); const { HLFilesystemOperation } = require("./definitions"); +const { APIError } = require('../../api/APIError'); class HLStat extends HLFilesystemOperation { static MODULES = { diff --git a/packages/backend/src/filesystem/lib/PuterPath.js b/packages/backend/src/filesystem/lib/PuterPath.js index db12145b..2d2d676c 100644 --- a/packages/backend/src/filesystem/lib/PuterPath.js +++ b/packages/backend/src/filesystem/lib/PuterPath.js @@ -64,10 +64,6 @@ class PuterPath { return ! this.isAbsolute(); } - get hasRelativePortion () { - - } - get reference () { if ( this.isAbsolute ) return this.constructor.NULL_UUID; diff --git a/packages/backend/src/filesystem/ll_operations/ll_copy_idea.js b/packages/backend/src/filesystem/ll_operations/ll_copy_idea.js index 3ee21ac9..e3909def 100644 --- a/packages/backend/src/filesystem/ll_operations/ll_copy_idea.js +++ b/packages/backend/src/filesystem/ll_operations/ll_copy_idea.js @@ -30,6 +30,7 @@ - easier to diagnose stuck operations */ +/* eslint-disable */ const STEPS_COPY_CONTENTS = [ { diff --git a/packages/backend/src/filesystem/ll_operations/ll_read.js b/packages/backend/src/filesystem/ll_operations/ll_read.js index c2279e9c..a133c74b 100644 --- a/packages/backend/src/filesystem/ll_operations/ll_read.js +++ b/packages/backend/src/filesystem/ll_operations/ll_read.js @@ -91,7 +91,7 @@ class LLRead extends LLFilesystemOperation { const context = a.iget('context'); const svc_fileCache = context.get('services').get('file-cache'); - const { fsNode } = a.values(); + const { fsNode, offset, length } = a.values(); const maybe_buffer = await svc_fileCache.try_get(fsNode, a.log); if ( maybe_buffer ) { diff --git a/packages/backend/src/filesystem/ll_operations/ll_rmnode.js b/packages/backend/src/filesystem/ll_operations/ll_rmnode.js index cb4d2469..0fa6c11f 100644 --- a/packages/backend/src/filesystem/ll_operations/ll_rmnode.js +++ b/packages/backend/src/filesystem/ll_operations/ll_rmnode.js @@ -19,6 +19,7 @@ const { Context } = require("../../util/context"); const { ParallelTasks } = require("../../util/otelutil"); const { LLFilesystemOperation } = require("./definitions"); +const { APIError } = require("../../api/APIError"); class LLRmNode extends LLFilesystemOperation { async _run () { diff --git a/packages/backend/src/filesystem/storage/SystemFSEntryService.js b/packages/backend/src/filesystem/storage/SystemFSEntryService.js index e9abb9ba..6cc8ef4b 100644 --- a/packages/backend/src/filesystem/storage/SystemFSEntryService.js +++ b/packages/backend/src/filesystem/storage/SystemFSEntryService.js @@ -17,6 +17,7 @@ * along with this program. If not, see . */ const { PuterPath } = require("../lib/PuterPath"); +const _path = require('path'); // Redis keys: // ::::: diff --git a/packages/backend/src/filesystem/validation.js b/packages/backend/src/filesystem/validation.js index bec9875a..a9cf934e 100644 --- a/packages/backend/src/filesystem/validation.js +++ b/packages/backend/src/filesystem/validation.js @@ -22,10 +22,12 @@ This module contains functions that validate filesystem operations. */ +/* eslint-disable no-control-regex */ + const config = require("../config"); const path_excludes = () => /[\x00-\x1F]/g; -const node_excludes = () => /[\/\x00-\x1F]/g; +const node_excludes = () => /[/\x00-\x1F]/g; // this characters are not allowed in path names because // they might be used to trick the user into thinking