Skip to content

Commit 607f527

Browse files
committed
changed metadata to dict list
1 parent f957512 commit 607f527

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

databusclient/cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ def upload_and_deploy(webdav_url, remote, path, no_upload, metadata, version_id,
125125
click.echo(f"Creating {len(metadata)} distributions")
126126
distributions = []
127127
counter = 0
128-
for filename, checksum, size, url in metadata:
128+
for entry in metadata:
129+
filename = entry["filename"]
130+
checksum = entry["checksum"]
131+
size = entry["size"]
132+
url = entry["url"]
129133
# Expect a SHA-256 hex digest (64 chars). Reject others.
130134
if not isinstance(checksum, str) or len(checksum) != 64:
131135
raise ValueError(f"Invalid checksum for {filename}: expected SHA-256 hex (64 chars), got '{checksum}'")

databusclient/metadata.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[
2-
[
3-
"example.ttl",
4-
"6e340b9cffb37a989ca544e6bb780a2c7e5d7dcb",
5-
12345,
6-
"https://cloud.example.com/remote.php/webdav/datasets/mydataset/example.ttl"
7-
],
8-
[
9-
"example.csv.gz",
10-
"3f786850e387550fdab836ed7e6dc881de23001b",
11-
54321,
12-
"https://cloud.example.com/remote.php/webdav/datasets/mydataset/example.csv.gz"
13-
]
2+
{
3+
"filename": "example.ttl",
4+
"checksum": "6e340b9cffb37a989ca544e6bb780a2c7e5d7dcb",
5+
"size": 12345,
6+
"url": "https://cloud.example.com/remote.php/webdav/datasets/mydataset/example.ttl"
7+
},
8+
{
9+
"filename": "example.csv.gz",
10+
"checksum": "3f786850e387550fdab836ed7e6dc881de23001b",
11+
"size": 54321,
12+
"url": "https://cloud.example.com/remote.php/webdav/datasets/mydataset/example.csv.gz"
13+
}
1414
]

nextcloudclient/upload.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ def upload_to_nextcloud(source_paths: list[str], remote_name: str, remote_path:
5454
url = urljoin(webdav_url.rstrip("/") + "/", quote(remote_webdav_path.lstrip("/"), safe="/"))
5555

5656
filename = os.path.basename(file)
57-
tmp_results.append((filename, checksum, size, url))
57+
tmp_results.append({
58+
"filename": filename,
59+
"checksum": checksum,
60+
"size": size,
61+
"url": url,
62+
})
5863

5964
dest_subpath = posixpath.join(remote_path.lstrip("/"), basename)
6065
if os.path.isdir(path):

0 commit comments

Comments
 (0)