Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"pop from empty list" in Nextcloud importer #1274

Closed
MarcusWolschon opened this issue Jan 10, 2022 · 3 comments
Closed

"pop from empty list" in Nextcloud importer #1274

MarcusWolschon opened this issue Jan 10, 2022 · 3 comments
Labels
backend issues that affect the python backend bug Something isn't working
Milestone

Comments

@MarcusWolschon
Copy link
Contributor

MarcusWolschon commented Jan 10, 2022

Version

Please provide your current version (can be found on the system page since v0.8.4)
Version: 1.0.4

Bug description

At line 32 in nextcloud.py a list "files" is not checked for being empty with an error message for the user/site administrator.
Instead the application just crashes.
The user/site-administrator should get an erro message. Preferably indicating what settings may be wrong
or at the very least wich of the configured storage sources the issue happened with.

Steps:
Set up a Nextcloud folder according to https://docs.tandoor.dev/features/external_recipes/#Nextcloud

  1. "external receips"
  2. press button "sync now"
  3. "receipts being imported" shown for 2 seconds
  4. Get redirected to "/api/sync_all/" showing a very helpful "Server Error (500)"

Error: (only visible with DEBUG=1 in Docker. Else there is no information at all. That missing error message is the bug.)
Exception Value: | pop from empty list
/opt/recipes/cookbook/provider/nextcloud.py, line 32, in import_all
grafik

@MarcusWolschon
Copy link
Contributor Author

(
I already had to guess that a DEBUG=0 means that at least the value 1 could provide some kind of helpful output here.
There is nothing about error logging in the documentation on the website.
)

@MarcusWolschon
Copy link
Contributor Author

Suggestion:

if len(files) == 0:
    log_entry = SyncLog(
            status='FAILED',
            msg='No files in ' + monitor.path,
            sync=monitor,
        )
else 
    files.pop(0)

@vabene1111 vabene1111 added backend issues that affect the python backend bug Something isn't working labels Jan 12, 2022
@vabene1111 vabene1111 added this to the 1.1.0 milestone Jan 12, 2022
@vabene1111
Copy link
Collaborator

importing nothing from an empty folder is the expected and correct behavior thus i have added a check to the pop function to not crash if the folder is empty but return a successful but empty import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend issues that affect the python backend bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants