summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-05-09 22:20:21 -0700
committerPinapelz <yukais@pinapelz.com>2025-05-09 22:20:21 -0700
commit44c1eddd338a059f0451bffd06215299a8986894 (patch)
tree7bfd80953e8442d19a5687f2eb8ecfe0790a75f0
parent8b98002557263edf783b0e2d2115f9e8b74593f7 (diff)
fix: html upload content type and indentation
-rw-r--r--nijitrack.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/nijitrack.py b/nijitrack.py
index 0cf847c..caccb0c 100644
--- a/nijitrack.py
+++ b/nijitrack.py
@@ -173,7 +173,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")
@@ -190,7 +190,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
@@ -297,12 +297,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....")
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage