chore: pr feedbacks
This commit is contained in:
parent
c6955b4283
commit
fb80d7b8f4
2 changed files with 9 additions and 4 deletions
|
|
@ -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") {
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue