google-cloud-storage

Set default meta-data for all future uploaded objects in GCP Bucket

房东的猫 提交于 2021-01-29 10:23:50
问题 I would like to know how could I set default meta-data for all future uploaded objects. Am trying to set "Cache-Control:public,max-age=3600" as a header for each object in my bucket hosting a static website. For all the existing objects, I used the guide command to set meta data, although, can't find a way to set it by default for future uploaded objects. P.S., Developers are using GCP console to upload the objects, and I recently realized that when they upload the updated HTML files (which

Firebase Storage security rules and firestore

自闭症网瘾萝莉.ら 提交于 2021-01-29 10:01:25
问题 I have "groups" in Firestore. Each group has a "members" key. My goal is to write a Firebase Storage security rule to allow "write" only to members of a group: # I want something like this match /groups/{groupId} { allow read, write: if request.auth.uid in get(/database/groups/{groupId}/members); } 回答1: Security rules cannot read from another service, so you won't be able to implement groups in the way you describe here. You'll instead have to encode the knowledge of what groups somebody is a

400 Bad request when uploading image to Google Cloud storage using Python 3 Flask

断了今生、忘了曾经 提交于 2021-01-29 09:48:52
问题 I'm trying to upload a image to cloud storage using blob.upload_from_string but I get a 400 Bad Request Error I'm following this tutorial, but the difference is that I want to send a string instead of a file, and the string contains the image. This is the function : def upload_image_file(self, file): """ Upload the user-uploaded file to Google Cloud Storage and retrieve its publicly-accessible URL. """ if not file: return None testImageString = "Python is interesting." arr = bytes

How to avoid files that are not found (WinError 3)?

本小妞迷上赌 提交于 2021-01-29 08:08:18
问题 I was trying to back up my whole computer drive to google cloud storage, people mainly told me that was nonsensical, and while pondering it all, I decided just to do documents and desktop, and my goal was to use the google cloud SDK as I'm new to this and I like a challenge. So I type in: gsutil -m rsync -n -J -C -e -r -u -U C:\Users\~~~~\Documents gs://~~~~-pc/documents When I send that, I receive this message: Caught non-retryable exception while listing file://C:\Users~~~~~\Documents:

Node.js Cloud Function - Stream CSV data directly to Google Cloud Storage file

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-29 07:49:01
问题 I have a script that can call a RESTful API and retrieve CSV data from a report in chunks. I'm able to concatenate, parse, and display this data in the console. I am also able to write this CSV data to a local file and store it. What I am trying to figure out is how to skip creating a file to store this data before uploading it to GCS and instead transfer it directly into Google Cloud Storage to save as a file. Since I am trying to make this a serverless cloud function, I am trying to stream

Google Cloud Storage | PHP | Uploaded files are at 0 Bytes

只愿长相守 提交于 2021-01-29 07:31:43
问题 I am using a Codeigniter application and trying to provide access for users to upload files. the server is setup on a Google Compute Engine VM running CentOS 7 and Apache 2, I am trying to use Google Cloud Storage for user upload. Currently when I upload files only the file names are being uploaded into GCS Bucket with the file size as 0 bytes. My Frontend Code: <body> <form action="/includes/includes_gc/do_upload" class="dropzone" id="pfUploads" enctype="multipart/form-data"> </form> <script

How to mock google cloud storage bucket and link it to client object?

大兔子大兔子 提交于 2021-01-29 06:27:40
问题 I have a function in cloud run and trying to test using mock in Python. How can I mock bucket with a blob and attach it to storage client? Assert fails and it's displaying output in this format Display File content: <MagicMock name='mock.get_bucket().get_blob().download_as_string().decode()' id='140590658508168'> # test def test_read_sql(self): storage_client = mock.create_autospec(storage.Client) mock_bucket = storage_client.get_bucket('test-bucket') mock_blob = mock_bucket.blob('blob1')

Can't resolve getSignedUrl Promise in Cloud Function

ぃ、小莉子 提交于 2021-01-29 05:25:54
问题 I have been trying to debug a Google Cloud Function that should return a signedUrl for uploading a file to Google Cloud Storage. I have an https cloud function: exports.gcpSecureURL = functions.https.onCall((data, res) => { const bucketName = data.bucket; const fileName = data.filename; let signedUrl = generateV4UploadSignedUrl(bucketName, fileName) .then(value => { console.log("VALUE: ", value); return value }) res.send(signedUrl) }); Value is never reached and signedUrl is always a Promise.

Google Cloud Storage hosted images don't show in my app

那年仲夏 提交于 2021-01-28 12:25:26
问题 I'm using Google Cloud Storage to store some images for my mobile app. All is good, I set my bucket to public and I can display images on my laptop web browser but I don't know why my mobile app doesn't show them. The default link just doesn't work : https://storage.cloud.google.com/xxxxxx/img.jpg I've discovered a temporary fix. It works when i manually put the redirected link generated like this : https://00e9e64bac5058e148f83f51ad2da7ad0739d5d15096126e97-apidata.googleusercontent.com

File Uploaded but not shown in the Firebase realtime database - Android Studio

夙愿已清 提交于 2021-01-28 12:19:28
问题 In my android app when I am uploading a PDF file it's uploaded in the firebase storage but the file name and url is not shown in the realtime database. private void uploadPDFFile(Uri data) { final ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setTitle("Uploading..."); progressDialog.show(); StorageReference reference = storageReference.child("uploads/"+System.currentTimeMillis()+".pdf"); reference.putFile(data) .addOnSuccessListener(new OnSuccessListener<UploadTask