GCP public file download without prefix - google-cloud-platform

When I visit a public URL to my uploaded file, the filename includes the prefix, resulting in a super long filename.
Is there a way to download a file from the browser without including the prefix?
Maybe a setting or metadata to the uploaded file, or something?
My backend runs on NodeJS, if that's relevant.

In your webserver, you can override the default file name by writing a specific header
request.setHeader('Content-Disposition', 'filename="fileName.txt"');

Related

Microsoft Graph API - Error: The Content-Range header length does not match the provided number of bytes

I am trying to upload a file to the Shared Documents library of my SharePoint website. The files are of type PDF and HTML. I am running a Cold Fusion development environment and using CFHTTP commands to execute HTTP requests. I have been able push a POST command and a PUT command to the proper endpoints listed on this link below:
Link: https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0#best-practices
I do not understand why but the first section that mentions the HTTP requests for creating an upload session is different than what was used in the example a little further. For my project, I am using the endpoint:
"/{variables.instance.microsoftGraphAPIURL}/drive/root:/{item-path}:/createUploadSession"
P.S. variables.instance.microsoftGraphAPIURL is a variable to a microsoft graph endpoint to our Sharepoint website
With better luck using PUT commands than POST commands for creating an Upload Session. I am able to receive an uploadURL, but the issue comes with trying to upload the file. For the file upload, I am trying to upload a file in the same directory with a file size of 114992 bytes. I keep getting "The Content-Range header length does not match the provided number of bytes." whenever I run my Put command to upload the file.
Thus, my Content-Range is "bytes 0-114991/114992" and my Content-Length is "114992". For the image below, I replaced the file with a pdf, but the original file was an HTML page at 114992 bytes. I want to use a resumable upload session to have one function for uploading image, HTML, and PDF files.
If anyone could tell me if there is an issue with my content headers or my upload session http request or anything else that is causing my issue, that would be amazing! Thank you.

In S3 bucket how to properly configure files in json format to be downloaded or to be read?

My question came out when I experienced two different behaviors in object URL from json files stored in a s3 bucket.
Consider a json file: mydata.json
If I upload this file using s3 dashboard from AWS website, I am able to see data in browser: //s3-us-west-2.amazonaws.com/bucket/folder/mydata.json. I am also able to read this data from a different application if I create a specific configuration in s3 bucket.
For the other hand, if I use boto3 library for python and upload the same file in the same bucket (making file public in the process), when I click object URL it downloads the file, but it doesn't open data in browser.
This is the code I used:
# upload json file
bucket.upload_file(path, jsonkey)
object_acl = s3.ObjectAcl('bucket_name', jsonkey)
bucket_response = object_acl.put(ACL='public-read')
I explored file properties such as metadata. When I upload file via dashboard, the metadata assigned is Content-Type: application/json, and via boto3 is Content-Type: binary/octet-stream. I don't really know if metadata affects the object URL behavior.
In this context, how can I properly configure files in json format to be downloaded or to be read? I mean, what is the main configuration that affects object URL behavior?
I couldn't find a significant difference between both methods (dashboard and boto3) in properties or permissions, besides Content-Type in metadata. However, when I tried to change Content-Type, behavior was the same.
Any other information I can provide to clarify this question, be free to ask. Thanks in advance.
The documentation for the S3 bucket resource's upload_file() method is not ideal as it simply refers you to the equivalent S3Transfer docs for how extra arguments can be used.
Try the following:
bucket.upload_file(path, jsonkey, ExtraArgs={'ContentType': "application/json"})

Removeing http_access_yyyy_mm_dd.log file in wso2 API Manager

I have one problem with API Manager.
I don't want to have logs of requests and responses in API Manager, because those log files are so big and I encounter files with 20G. I tried to comment Catalina access file, which is in repositoy/conf/tomcat/catalina-server.xml:
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="${carbon.home}/repository/logs"
prefix="http_access_"
suffix=".log"
pattern="combined"/>
Unfortunately, after commenting the above code, only http_access_.log file didn't created, but http_access_yyyy_mm_dd.log was created and requests saved in it. I tried to change directory of above file, too. Only file http_access_.log saved in new directory, and http_access_yyyy_mm_dd.log is still created in the ${carbon.home}/repository/logs directory.
How can change configuration of http_access_yyyy_mm_dd.log in wso2 API Manager?
According to the Apache Documentation,
The name of the file is composed by concatenation of the configured
prefix, timestamp and suffix
You can simply comment out the code snippet which you have mentioned which can be found in <PRODUCT_HOME>\repository\conf\tomcat\catalina-server.xml.
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="${carbon.home}/repository/logs" prefix="http_access_" suffix=".log"b pattern="combined"/>
In simple comment the above code snippet in the mentioned file path and restart the WSO2 APIM server.

GCP Storage: url encoded Object Path added to Object Name

I have the following folder structure in my bucket:
Structure: Bucket-Name/YEAR/Folder/Objects
Example Path: mybucket/2018/myEXEs/file.exe
Issue: When I try to download an object (file.exe) from example path above by clicking on the EXE, the filename that appears in the download dialog box looks like this:
"2018%2FmyEXEs%2Ffile.exe"
You have to strip the URL encoded path every time and this is an inconvenience if you do not want to make the URL public.
Observation:
It appears the storage browser adds bucket path to the filename and that gets encoded to replace '/'.
This does not happen when you download the object using public URL.
Question:
Is there a way to strip the URL encoded path from filename?
There is a feature request in the public tracker for this. As mentioned in the same link, there is a workaround by setting the filename in the Content-Disposition metadata of the files. To do it, go to Cloud Storage, edit metadata of a file and, in Content-Disposition field, add:
attachment; filename="filename"
The the only inconvenient with this workaround is that you have to set filenames in all the download files's metadatas.

Informatica permission and account to write target file to another server folder

I need to specify that target file to be written to a specified folder in another server beside on the same box as Informatica.
I looked in the session property and do not see an entry to specify the account name and password?
The account name has the permission to the folder in the other server.
Any help is appreciated
Thanks
Beside using FTP it might be possible (depending on your environment) to map the required server path and use it directly.
You have to create a ftp connection string if you want to directly write to a file in another server.
Or else you can write a script which would ftp the file after it is generated on the informatica server.