-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Cannot upload to Azure due to improper Url construction #1949
Comments
I don't have time to look into this, but if you do find the cause for your issue, and if the issue is indeed caused by Fine Uploader, please do open up a PR with the fix. |
RESOLVED. The issue isn't technically due to Fine Uploader, but Fine Uploader could be tweaked to handle this discrepancy. ASP.NET MVC will treat string responses as JSON, and therefore will wrap "quotes" around output, and add the Content-Type "application/json" for you automagically. By adding a "Produces" attribute to the controller, it forces the Content-Type you want: [HttpGet] Yay! So yeah, File Uploader could be enhanced to trim junk like that, but it's really not the responsibility of the library IMO. @rnicholus Just FYI, the docs are out of sync with the latest code on that parameter I highlighted above. it's |
This is an instance where I would really appreciate a PR to fix this docs issue. Thanks for the report. |
Honestly, I'm thinking about doing an entire .NET article. It was waaaay too much pain to put a simple thing together due to gotchas you just don't think about every day, and I was shocked to see no real ASP.Net examples out there. But yes, I will see what I can do about a PR for that at the very least. |
A .NET article would be awesome. Were I a .NET developer, I’m sure I would have created a server side example, but alas I am not. So contributions welcome/encouraged. |
Just in case somebody else is searching, I had the same problem. In my case it was mistake I made in SAS signer in my nodejs server: I was returning SAS token instead of SAS Uri. Also I can confirm that returning it as text/html works fine. |
Type of issue
Uploader type
Fine-Uploader is prefixing the host site url to the Azure PUT request
Fine Uploader version
5.13.0
Browsers where the bug is reproducible
"Firefox" and "IE11" (and n/a)
Operating systems where the bug is reproducible
Windows 10
Exact steps required to reproduce the issue
For example:
All relevant Fine Uploader-related code that you have written
` <script>
// Some options to pass to the uploader are discussed on the next page
var uploader = new qq.azure.FineUploader({
element: document.getElementById("uploader"),
request: {
endpoint: 'https://xxxx.blob.core.windows.net/user-content'
},
signature: {
endpoint: '/profile/uploadsignature'
},
uploadSuccess: {
endpoint: '/profile/uploadsuccess'
},
retry: {
enableAuto: true
},
deleteFile: {
enabled: true
}
Detailed explanation of the problem
Check this out, this is the RAW request captured in Fiddler:
PUT http://localhost:50021/%22https://xxxx.blob.core.windows.net/user-content/bd740824-3091-49f3-9448-6e6c1ece9d84.png?sv=2016-05-31&sr=b&sig=kOJhfV45%2Bk11Ov20vZChr7OvHKbYe%2Bk%2BJFe4SVVqRNA%3D&se=2017-11-18T02%3A14%3A29Z&sp=w%22 HTTP/1.1
See anything wrong here? PUT should NOT be going to http://localhost:50021 at all! And you can also see that Fine-Uploader concatenated it with the proper Url wrapped in encoded double quotes (%22)
My signature code is the same as your C# server example, and I can confirm it returns the proper sas Url (https://xxxx.blob.core.windows.net/... ) WITHOUT being prefixed with the root of my site (http://localhost:50021). My site is ASP.NET MVC Core 2.0 (irrelevant, but interesting).
The issue appears to be within Fine-Upload js code somewhere, wherever it is appending things and ultimately making the request to Azure.
The text was updated successfully, but these errors were encountered: