diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-05-09 22:20:21 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-05-09 22:20:43 -0700 |
| commit | 700cdfcb4d9b76e9adfab32ea13fc4b9693bca0f (patch) | |
| tree | a45249a4c20d2a15a9de7425b4628a5e4c962e70 | |
| parent | 87a2e05adf6c1dd63db008a894b417f9fa5e9cc7 (diff) | |
fix: html upload content type and indentation
| -rw-r--r-- | nijitrack.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/nijitrack.py b/nijitrack.py index 32f9d0b..a1a55ea 100644 --- a/nijitrack.py +++ b/nijitrack.py @@ -159,7 +159,7 @@ def uploadFileToBucketB2(filepath: str) -> bool: print(e) return False -def uploadFileToBucketR2(filepath: str) -> bool: +def uploadFileToBucketR2(filepath: str, content_type: str = "application/json") -> bool: import boto3 account_id = os.environ.get("R2_ACCOUNT_ID") access_key = os.environ.get("R2_ACCESS_KEY") @@ -176,7 +176,7 @@ def uploadFileToBucketR2(filepath: str) -> bool: s3.Bucket(bucket_name).upload_fileobj( Fileobj=f, Key=filepath, - ExtraArgs={"ContentType": "application/json"} + ExtraArgs={"ContentType": content_type} ) print("Successfully uploaded", filepath, "to R2") return True @@ -279,12 +279,12 @@ if __name__ == "__main__": if args.uploadGraph: if upstream_bucket is None: print("Tried to upload graph but no remote source has been specified. Skipping....") - match upstream_bucket: - case BucketType.B2: - uploadFileToBucketB2("index.html") - case BucketType.R2: - uploadFileToBucketR2("index.html") - + exit(1) + match upstream_bucket: + case BucketType.B2: + uploadFileToBucketB2("index.html") + case BucketType.R2: + uploadFileToBucketR2("index.html", content_type="text/html; charset=utf-8") if args.uploadRoutes: if upstream_bucket is None: print("Tried to upload routes but no remote source has been specified. Skipping....") |
