2
votes

My google cloud storage browser is seeing the incorrect content-type on all of my static files (css, js, jpg, etc.) and this is causing a mime type error when serving these files which causes my website to not apply my css styles. Why is this happening and how can I fix this? I am linking my static files correctly and with specifying the correct content-type, but this error is still happening.

<link rel="stylesheet" type="text/css" media="screen,print" href="index_files/index.css" />
<script type="text/javascript" src="index_files/index.js"></script>

As you can see in the following images, google cloud storage is seeing these static files with content-type application/octet-stream when it should be seeing them as text/css and text/javascript.

enter image description here enter image description here

UPDATE

The files are uploaded manually to the bucket.

2
How are these being added to the bucket? - Phix
Please edit the question to be clear about how your objects are being added. Whatever the process is that adds the files needs to set the content type appropriately, or you will have to do something else to change the type. - Doug Stevenson
I just updated my question. I upload my files manually to the bucket by clicking on "Upload files" then selecting all the files I want to upload to the bucket, replacing whichever ones I'm updating. - Michael Miller

2 Answers

2
votes

You will have to manually edit the content type in the console. The instructions are in the documentation:

  1. Open the Cloud Storage browser in the Google Cloud Console.

  2. In the list of buckets, click on the name of the bucket that contains the desired object, and navigate to the object.

  3. Certain pieces of object metadata, such as the object's size and storage class, are displayed along with the object's name.

  4. Click the more actions menu () associated with the object.

  5. Click Edit metadata. The overlay window that appears shows the current values for the object's editable metadata.

1
votes

if you want to bulk upload your local files to Cloud Storage without having issues with octet-stream you can use Cloud SDK to upload it using gsutil command:

gsutil -m cp -r dir_of_folder_to_upload gs://bucket_name/folder