Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploaded Images contain HTML data #2844

Closed
dsingh80 opened this issue Nov 16, 2021 · 1 comment
Closed

Uploaded Images contain HTML data #2844

dsingh80 opened this issue Nov 16, 2021 · 1 comment
Labels
triage me I really want to be triaged.

Comments

@dsingh80
Copy link

dsingh80 commented Nov 16, 2021

Overview & Techstack

I'm trying to upload images to drive. The server is running Express inside a Docker container behind Nginx.
To authenticate, I'm using Service Account with full permissions to every folder I've tested.

Issue

I receive a perfect 200 status every time. The image that's uploaded is never the actual image. Instead it contains the following redirect html body

<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>openresty</center>
</body>
</html>

Tested & Working

I've tested both simple and multipart uploads.
I've also tested uploading to both personal and shared drives
Both of these methods work. The file shows up in the correct folder, just with invalid data.

let fileMetaData = {
   name: fileName,
   mimeType: fileMimeType,
   parents: [folderId]
};
let media = {
   mimeType: fileMimeType,
   body: fs.createReadStream(filePath)
};

self.driveClient.files.create({
   resource: fileMetaData, // required for multipart upload,
   media: media,
   fields: 'id',
   supportsAllDrives: true,
   parents: [folderId],
}, function (err, res) {
   if (err) {
       callback(err.response.data.error);
       return;
   }
   callback(null, res.data.id);
});

Recreation Steps

  1. Run the code above
  2. Use any image less than 5Mb
  3. Receive a '200' OK status on upload and the id of the uploaded image
  4. Find image in drive (can't open with preview or image viewer)
  5. Open image with text editor
  6. Stare at html
@dsingh80 dsingh80 changed the title Uploaded Media contains 301 Redirect HTML body Uploaded Images contain HTML data Nov 16, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Nov 16, 2021
@SurferJeffAtGoogle
Copy link
Contributor

I think this is actually an issue with the API. Please report an issue here:
https://cloud.google.com/support/docs/issue-trackers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants