You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Put it in a file called gogol-bug.hs. Set the bucket variable to a bucket in your account. Then, chmod u+x gogol-bug.hs. Run ./gogol-bug.hs. Get this as output:
[Client Request] {
host = www.googleapis.com:443
secure = True
method = POST
timeout = ResponseTimeoutMicro 70000000
redirects = 10
path = /upload/storage/v1/b/a-bucket/o
query = ?name=gogol-bug%3Aa-key&alt=json&uploadType=multipart
headers = <REDACTED>
body = <msger:253>
}
[Client Response] {
status = 200 OK
headers = <REDACTED>
}
[Client Request] {
host = www.googleapis.com:443
secure = True
method = GET
timeout = ResponseTimeoutMicro 70000000
redirects = 10
path = /storage/v1/b/a-bucket/o/gogol-bug:a-key
query = ?alt=media
headers = <REDACTED>
body =
}
[Client Response] {
status = 200 OK
headers = <REDACTED>
}
gogol-bug:a-key download successful
[Client Request] {
host = www.googleapis.com:443
secure = True
method = POST
timeout = ResponseTimeoutMicro 70000000
redirects = 10
path = /upload/storage/v1/b/a-bucket/o
query = ?name=gogol-bug%3Aa-key%2Fwith-slashes&alt=json&uploadType=multipart
headers = <REDACTED>
body = <msger:253>
}
[Client Response] {
status = 200 OK
headers = <REDACTED>
}
[Client Request] {
host = www.googleapis.com:443
secure = True
method = GET
timeout = ResponseTimeoutMicro 70000000
redirects = 10
path = /storage/v1/b/a-bucket/o/gogol-bug:a-key/with-slashes
query = ?alt=media
headers = <REDACTED>
body =
}
[Client Response] {
status = 404 Not Found
headers =
}
gogol-bug.hs: ServiceError (ServiceError' {_serviceId = ServiceId "storage:v1", _serviceStatus = Status {statusCode = 404, statusMessage = "Not Found"}, _serviceHeaders = [("X-GUploader-UploadID",<REDACTED>),("Vary","Origin"),("Vary","X-Origin"),("Content-Type","text/html; charset=UTF-8"),("Date","Thu, 07 Dec 2017 14:43:31 GMT"),("Expires","Thu, 07 Dec 2017 14:43:31 GMT"),("Cache-Control","private, max-age=0"),("Content-Length","9"),("Server","UploadServer"),("Alt-Svc",<REDACTED>)], _serviceBody = Just "Not Found"})
In other words, uploading an object with a slash in the key works, but downloading fails. Specifically, note the path of the request, /storage/v1/b/a-bucket/o/gogol-bug:a-key/with-slashes. The google docs specify that path parts must be url encoded - https://cloud.google.com/storage/docs/json_api/#encoding . However, it appears that they are being substituted verbatim.
Is this a gotcha with servant's Capture for Text?
The text was updated successfully, but these errors were encountered:
Yeah, I think the escaping ought to be handled by the library. FWIW, here's the function I wrote for doing the escaping, back when I encountered this issue:
To use it, Network.Google.Storage.objectsGet bucket (urlEncodeKey key). It should be possible to write a more efficient version that doesn't convert to ByteString and back, but eh
Here is a repro:
Put it in a file called
gogol-bug.hs
. Set thebucket
variable to a bucket in your account. Then,chmod u+x gogol-bug.hs
. Run./gogol-bug.hs
. Get this as output:In other words, uploading an object with a slash in the key works, but downloading fails. Specifically, note the path of the request,
/storage/v1/b/a-bucket/o/gogol-bug:a-key/with-slashes
. The google docs specify that path parts must be url encoded - https://cloud.google.com/storage/docs/json_api/#encoding . However, it appears that they are being substituted verbatim.Is this a gotcha with servant's
Capture
forText
?The text was updated successfully, but these errors were encountered: