-
Notifications
You must be signed in to change notification settings - Fork 6
Native upload: Handle file replacements and metadata updates. #34
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
base: main
Are you sure you want to change the base?
Conversation
Hmm, the seems to be some side-effect for the filepath to directory_label handling. |
Actually, no. The same test fails with no code change to main at all: |
There must be a bug in a recent change for the dataverse test container. Otherwise I cannot fathom why the zip upload now fails to create the correct diff --git a/dvuploader/nativeupload.py b/dvuploader/nativeupload.py
index 7296c86..4754724 100644
--- a/dvuploader/nativeupload.py
+++ b/dvuploader/nativeupload.py
@@ -91,6 +91,8 @@ async def native_upload(
"proxy": proxy,
}
+ rich.print(files)
+
async with httpx.AsyncClient(**session_params) as session:
with tempfile.TemporaryDirectory() as tmp_dir:
packages = distribute_files(files)
diff --git a/dvuploader/packaging.py b/dvuploader/packaging.py
index c99d4d1..18bc8f9 100644
--- a/dvuploader/packaging.py
+++ b/dvuploader/packaging.py
@@ -99,6 +99,8 @@ def zip_files(
zinfo_or_arcname=_create_arcname(file),
)
+ zip_file.printdir()
+
return path
|
@bnavigator, thanks for submitting the PR! Indeed, this is quite strange, and I agree with you. The only thing that comes to mind as a possible reason for its failure could be related to the new Dataverse images. I’ll test it locally and check the logs to see if that helps with debugging. |
Oddly, the tests run smoothly on a local instance, suggesting that the Dataverse Action might be the issue. However, I’m not sure about the exact problem because, as far as I know, the ![]() In this test run, I’ve added an additional test to explicitly check for |
…directory label. a first run is assured by _validate_files being run before.
317ade7
to
66a4112
Compare
Yeah, I just replicated this at https://github.com/gdcc/python-dvuploader/actions/runs/17045098506/job/48318703025?pr=37 via #37 There's nothing weird in my no-op PR is there? I tried to simply make the same change as @bnavigator, which was just print statements. |
I can reproduce the failure locally so I created a dedicated issue for it: |
This PR addresses two limitations of the Native API uploader:
With this PR, the code checks if the file content has the same hash and only updates the metadata in this case.
-N.ext
filenameWith this PR, the code uploads the files to be replaced with new content individually instead of with a zipped package.
Example Output:
Also, the
restricted
property of a file should not get lost, when updating the metadata.