I am using Go SDK (1.9.34 - 2016-03-15
) on App Engine. The blobstore api was working correctly in both dev and production but now it seems to return different results, which now breaks the upload.
When I use this code in dev (using goapp serve
) and production I get different results. The GET
request comes with a parameter, which I extract and add it to the upload URL.
c := appengine.NewContext(r)
upUrl, err := blobstore.UploadURL(c, "/upload", nil)
c.Infof("Upload url = %+v", upUrl)
if (err != nil) { //error handling here }
param := r.FormValue("param")
q := upUrl.Query()
q.Set("param", param)
upUrl.RawQuery = q.Encode()
c.Infof("Upload url after query = %+v", upUrl)
In Dev
I get (this is the intended behavior):
Upload url = http://localhost:8080/_ah/upload/RANDOMSTRING
Upload url after query = http://localhost:8080/_ah/upload/RANDOMSTRING?param=99
In Prod
I get (incorrect upload url is being constructed):
Upload url = https://www.example.com/_ah/upload/?param=99/RANDOMSTRING1/RANDOMSTRING2/
Upload url after query = https://www.example.com/_ah/upload/?param=99
I know it is recommended to use Cloud Storage instead of blobstore but this is a legacy code so I don't want to change it right now. It was working fine a couple of weeks back and just noticed a difference. I upgrade from an older SDK to newer one (the results are based on the latest SDK) but still made no difference.
Any suggestions on what could be going wrong?
Thanks!