[GH-ISSUE #758] Self link and media link missing #127

Closed
opened 2026-03-03 12:08:32 +03:00 by kerem · 10 comments
Owner

Originally created by @robinjhector on GitHub (Apr 22, 2022).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/758

Hello!

Whenever I use the Google storage java sdk to list blobs in a fake-gcs-server bucket, none of the blobs have their "self link" and "media link" populated. I'm assuming this is a bug?

Originally created by @robinjhector on GitHub (Apr 22, 2022). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/758 Hello! Whenever I use the Google storage java sdk to list blobs in a fake-gcs-server bucket, none of the blobs have their "self link" and "media link" populated. I'm assuming this is a bug?
kerem 2026-03-03 12:08:32 +03:00
Author
Owner

@robinjhector commented on GitHub (Apr 25, 2022):

I'm quite dependent on this feature in my code :) Having the links available for verification in my tests would be awesome! The links themselfs could be totally fake or dead for my purposes. In other words, they don't have to work.

<!-- gh-comment-id:1108157131 --> @robinjhector commented on GitHub (Apr 25, 2022): I'm quite dependent on this feature in my code :) Having the links available for verification in my tests would be awesome! The links themselfs could be totally fake or dead for my purposes. In other words, they don't have to work.
Author
Owner

@fsouza commented on GitHub (Apr 25, 2022):

I'm quite dependent on this feature in my code :) Having the links available for verification in my tests would be awesome! The links themselfs could be totally fake or dead for my purposes. In other words, they don't have to work.

Hey, thanks for opening this issue. Do you know what they're usually set to? I can dig into the docs/run some real examples if not.

<!-- gh-comment-id:1108565680 --> @fsouza commented on GitHub (Apr 25, 2022): > I'm quite dependent on this feature in my code :) Having the links available for verification in my tests would be awesome! The links themselfs could be totally fake or dead for my purposes. In other words, they don't have to work. Hey, thanks for opening this issue. Do you know what they're usually set to? I can dig into the docs/run some real examples if not.
Author
Owner

@robinjhector commented on GitHub (Apr 25, 2022):

https://cloud.google.com/storage/docs/json_api/v1/objects

I believe mediaLink is usually the link to view an image or media object directly, eg. in browser. I think GCS serves the binary data with the correct content-type header, and the browser solves the rest.

SelfLink is the link to the object in the bucket, which, if I open it in a browser, will be downloaded.

<!-- gh-comment-id:1108574302 --> @robinjhector commented on GitHub (Apr 25, 2022): https://cloud.google.com/storage/docs/json_api/v1/objects I believe `mediaLink` is usually the link to view an image or media object directly, eg. in browser. I think GCS serves the binary data with the correct content-type header, and the browser solves the rest. SelfLink is the link to the object in the bucket, which, if I open it in a browser, will be downloaded.
Author
Owner

@fsouza commented on GitHub (Apr 25, 2022):

I believe mediaLink is usually the link to view an image or media object directly, eg. in browser. I think GCS serves the binary data with the correct content-type header, and the browser solves the rest.

Ohh interesting. Does that mean that it is not set for all objects?

<!-- gh-comment-id:1108578482 --> @fsouza commented on GitHub (Apr 25, 2022): > I believe mediaLink is usually the link to view an image or media object directly, eg. in browser. I think GCS serves the binary data with the correct content-type header, and the browser solves the rest. Ohh interesting. Does that mean that it is not set for all objects?
Author
Owner

@fsouza commented on GitHub (Apr 25, 2022):

I guess we don't need to care, we can just send the bytes with the appropriate Contet-Type and let the browser decide what to do with that.

For download we can do that + set Content-Disposition (or whatever the name of the header that forces download is).

<!-- gh-comment-id:1108589953 --> @fsouza commented on GitHub (Apr 25, 2022): I guess we don't need to care, we can just send the bytes with the appropriate Contet-Type and let the browser decide what to do with that. For download we can do that + set Content-Disposition (or whatever the name of the header that forces download is).
Author
Owner

@Jerome1337 commented on GitHub (Jan 16, 2023):

I'm facing the same issue today. This is not a blocker for me but it would be a real plus if the mediaLink is provided

<!-- gh-comment-id:1384364440 --> @Jerome1337 commented on GitHub (Jan 16, 2023): I'm facing the same issue today. This is not a blocker for me but it would be a real plus if the `mediaLink` is provided
Author
Owner

@andreoss commented on GitHub (Sep 7, 2023):

Any update on this?

<!-- gh-comment-id:1709491495 --> @andreoss commented on GitHub (Sep 7, 2023): Any update on this?
Author
Owner

@mdedetrich commented on GitHub (Nov 15, 2023):

Also facing the same issue, various clients for GCS don't work without this field because they assume its mandatory (and it should be).

<!-- gh-comment-id:1812700848 --> @mdedetrich commented on GitHub (Nov 15, 2023): Also facing the same issue, various clients for GCS don't work without this field because they assume its mandatory (and it should be).
Author
Owner

@rtrzebinski-usc commented on GitHub (Nov 22, 2023):

Same issue here, please implement media link so it can be tested, thank you.

<!-- gh-comment-id:1822157654 --> @rtrzebinski-usc commented on GitHub (Nov 22, 2023): Same issue here, please implement media link so it can be tested, thank you.
Author
Owner

@manuteleco commented on GitHub (Mar 8, 2024):

I have obviously encountered the same issue. Perhaps #1524 helps everyone here, as it helps me.

However, I've noticed a similar problem (missing attributes that lead to failures in certain client libraries) in the acl object response attribute. That attribute contains an array of JSON documents, which are also supposed to contain etag, selfLink and possibly other attributes that are currently missing. At least that led to errors with this library, so watch out for that.

Even though I've hit that similar other error with acl, I didn't address it because I have implemented #1520 instead. For my current use case I don't need ACL information, so having fake-gcs-server respect the projection parameter was enough for the time being. But if you need ACL information (projection=full), you might still hit a similar error until the missing attributes are added for ACLs as well, kind of like #1524 does for the top level attributes in the object response.

<!-- gh-comment-id:1986422227 --> @manuteleco commented on GitHub (Mar 8, 2024): I have obviously encountered the same issue. Perhaps #1524 helps everyone here, as it helps me. However, I've noticed a similar problem (missing attributes that lead to failures in certain client libraries) in the `acl` object response attribute. That attribute contains an array of JSON documents, which are also supposed to contain `etag`, `selfLink` and possibly other attributes that are currently missing. At least that led to errors with [this library][1], so watch out for that. Even though I've hit that similar other error with `acl`, I didn't address it because I have implemented #1520 instead. For my current use case I don't need ACL information, so having `fake-gcs-server` respect the `projection` parameter was enough for the time being. But if you need ACL information (`projection=full`), you might still hit a similar error until the missing attributes are added for ACLs as well, kind of like #1524 does for the top level attributes in the object response. [1]: https://crates.io/crates/google-cloud-storage
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#127
No description provided.