Skip to content

Commit

Permalink
Add x-meta-filename to the s3 upload request
Browse files Browse the repository at this point in the history
  • Loading branch information
sbq-clements committed Nov 13, 2023
1 parent 0c8a090 commit cd8a5b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ python cs_upload.py --trace-file foo.cst.gz ...

- `--trace-file` (required): trace file to upload
- `--trace-name` (optional): name of the trace created. Defaults to the file name.
- `--project-number` (required): the number of the project to upload to. You can find this
- `--project-id` (required): the number of the project to upload to. You can find this
in the web UI if you navigate to that project and then look in the URL, for example in
`https://[]/project/1022/dashboard`, the trace number is 1022.
- `--profile-number` (optional): the number of the profile you want to use for generating a
- `--profile-id` (optional): the number of the profile you want to use for generating a
report. If this is not present, no report will be generated. To find the profile number
you want, navigate to `/organization/profiles` and then select an appropriate profile.
In `/organization/profiles/211` or `/organization/profiles/211/detail`, the profile
Expand Down
5 changes: 3 additions & 2 deletions cs_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,9 @@ def upload_to_s3(self, form_data: str, trace_file: str) -> None:
fields = json.loads(form_data)
if "success_action_status" in fields:
fields["success_action_status"] = str(fields["success_action_status"])
if "x-amz-meta-filename" in fields:
fields["x-amz-meta-filename"] = os.path.basename(trace_file)

mime_type = self.mime_type(trace_file)
filename = os.path.basename(trace_file)
query = ["curl"]
if self.ca_cert and not self.no_check_certificate:
query += ["--cacert", self.ca_cert]
Expand All @@ -397,6 +396,8 @@ def upload_to_s3(self, form_data: str, trace_file: str) -> None:
"--form",
f"Content-Type={mime_type}",
"--form",
f"x-amz-meta-filename={filename}",
"--form",
f"file=@{trace_file}",
self.object_storage_url,
]
Expand Down

0 comments on commit cd8a5b9

Please sign in to comment.