mirror of
https://github.com/webrecorder/browsertrix-crawler.git
synced 2025-10-19 14:33:17 +00:00
Gracefully handle non-absolute path for create-login-profile --filename (#521)
Fixes #513 If an absolute path isn't provided to the `create-login-profile` entrypoint's `--filename` option, resolve the value given within `/crawls/profiles`. Also updates the docs cli-options section to include the `create-login-profile` entrypoint and adjusts the script to automatically generate this page accordingly. --------- Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
This commit is contained in:
parent
5152169916
commit
1325cc3868
5 changed files with 79 additions and 14 deletions
|
@ -52,7 +52,8 @@ function cliOpts(): { [key: string]: Options } {
|
|||
},
|
||||
|
||||
filename: {
|
||||
describe: "The filename for the profile tarball",
|
||||
describe:
|
||||
"The filename for the profile tarball, stored within /crawls/profiles if absolute path not provided",
|
||||
default: "/crawls/profiles/profile.tar.gz",
|
||||
},
|
||||
|
||||
|
@ -300,6 +301,13 @@ async function createProfile(
|
|||
|
||||
logger.info("Creating profile");
|
||||
|
||||
if (params.filename && !params.filename.startsWith("/")) {
|
||||
params.filename = path.resolve("/crawls/profiles/", params.filename);
|
||||
logger.info(
|
||||
`Absolute path for filename not provided, saving to ${params.filename}`,
|
||||
);
|
||||
}
|
||||
|
||||
const profileFilename = params.filename || "/crawls/profiles/profile.tar.gz";
|
||||
|
||||
const outputDir = path.dirname(profileFilename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue