Skip to content

Conversation

@NaitikRambhia
Copy link
Contributor

Summary:

Wrapped pickle.pickler in a Try, Except. Prompted user to reset depots using the reset depots function.

Motivation:

Prevents an error message after having a malformed depot.

References (optional):

Closes #342

Test Plan:

With npm installed:
powershell:

mkdir depot;
'[{"py/object":"pros.conductor.templates.base_template.BaseTemplate","metadata":{},"name":""}]' | Out-File -FilePath ./depot/depot.json ascii;
Start-Process npx -ArgumentList "-y http-server depot -p 8080";
sleep 6;
pros c add-depot malformed http://127.0.0.1:8080/depot.json;
pros c query-templates --force-refresh some-text;
pros --version

not windows:

mkdir depot 
echo '[{"py/object":"pros.conductor.templates.base_template.BaseTemplate","metadata":{},"name":""}]' >./depot/depot.json 
npx -y http-server depot -p 8080 & 
sleep 6
pros c add-depot malformed http://127.0.0.1:8080/depot.json
pros c query-templates --force-refresh some-text
pros --version

@meisZWFLZ
Copy link
Contributor

Shouldn't changes to the conductor.pros file be checked to ensure they create valid json, preventing the file from being malformed in the first place?

@BennyBot
Copy link
Member

BennyBot commented Oct 8, 2024

Ideally, yes, they should be. However, this does not prevent a user from going and modifying it themselves. Therefore, this check should be in there anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛Malformed Depot Breaks All CLI Functionality

4 participants