Skip to content

ecmwf-sites-upload: handle single-file upload result and add recursive option#110

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-error-handling-for-single-file
Draft

ecmwf-sites-upload: handle single-file upload result and add recursive option#110
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-error-handling-for-single-file

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 1, 2026

upload() returns a str for single-file uploads but the success check only handled list, causing false failures. Additionally, recursive=True was hardcoded with no way to override it.

Changes

  • Single-file result handling (upload.py): Extend success condition to accept str in addition to non-empty list:

    # before
    if isinstance(res, list) and len(res):
    # after
    if (isinstance(res, list) and len(res)) or isinstance(res, str):
  • --recursive argument (upload.py): Added optional CLI flag defaulting to True; accepts string input ("false"False, anything else → True):

    parser.add_argument("--recursive", type=lambda x: x.lower() != "false", default=True)

    Used in the upload call: recursive=args.recursive

  • Validation loop fix (upload.py): Changed if not vif v is None to prevent --recursive false from incorrectly triggering a "not provided" error.

  • action.yml: Exposed recursive as an optional input (default "true") and passes it through to the script.

Copilot AI changed the title [WIP] Fix script to handle single file input without error ecmwf-sites-upload: handle single-file upload result and add recursive option Apr 1, 2026
Copilot AI requested a review from EddyCMWF April 1, 2026 09:33
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.

2 participants