chore: pr feedbacks

This commit is contained in:
Nicolas Meienberger 2026-01-31 15:46:52 +01:00
parent c6955b4283
commit fb80d7b8f4
2 changed files with 9 additions and 4 deletions

View file

@ -371,7 +371,7 @@ const listFiles = async (
offset: startOffset, offset: startOffset,
limit: pageSize, limit: pageSize,
total, total,
hasMore: startOffset + entries.length < total, hasMore: startOffset + pageSize < total,
}; };
} catch (error) { } catch (error) {
if (isNodeJSErrnoException(error) && error.code === "ENOENT") { if (isNodeJSErrnoException(error) && error.code === "ENOENT") {

View file

@ -725,10 +725,10 @@ const ls = async (
let isFirstLine = true; let isFirstLine = true;
let hasMore = false; let hasMore = false;
const offset = options?.offset ?? 0; const offset = Math.max(options?.offset ?? 0, 0);
const limit = options?.limit ?? 500; const limit = Math.min(Math.max(options?.limit ?? 500, 1), 500);
await safeSpawn({ const res = await safeSpawn({
command: "restic", command: "restic",
args, args,
env, env,
@ -770,6 +770,11 @@ const ls = async (
await cleanupTemporaryKeys(env); await cleanupTemporaryKeys(env);
if (res.exitCode !== 0) {
logger.error(`Restic ls failed: ${res.error}`);
throw new ResticError(res.exitCode, res.error);
}
if (totalNodes > offset + limit) { if (totalNodes > offset + limit) {
hasMore = true; hasMore = true;
} }