-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add Azure blob storage backend #638
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hello @joshspicer , thank you very much for the contribution!
much appreciated!
please see my comments and we can probably merge this soon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i approve the PR, please just test the content range and change the service url that's currently hard-coded only if my question has a positive answer :)
send a final comment as feedback and i'm going to merge if nothing else is left!
thank you again for the contribution
server/storage/azure.go
Outdated
key := fmt.Sprintf("%s/%s", token, filename) | ||
blobClient := s.containerClient.NewBlobClient(key) | ||
|
||
var options *azblob.DownloadStreamOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 🥇
can you please make sure that content range works? you can test uploading a video an moving fast fowarded and skipping back and forth in the video player on the donwload page :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the idea of how to test, I wasn't familiar with content range before this. I'll give it a go soon and share the result 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a context canceled that should mean that the request to get the blob is timing out.
my guess is that the problem is that you pass rng.Limit
as the azblob.HTTPRange.Count
, that in this case is 0, and this might mess up the request, leading it to time out (instead of a more proper bad request status return).
it can't be that you have to set azblob.HTTPRange.Count
only if rng.Limit > 0
, because it is not a pointer, so the zero value is already 0
, but it might something like for storj:
transfer.sh/server/storage/storj.go
Lines 88 to 92 in 089ff32
if rng.Limit > 0 { | |
options.Length = int64(rng.Limit) | |
} else { | |
options.Length = -1 | |
} |
i suggest to give it a try with the same if
logic and -1
(is azblob.HTTPRange.Count
unsigned or not?), if it doesn't work let's look in the azblob documentation if anything is specified. if not, i guess we'd have to file a bug to azure for that.
do you have access to some kind of azure support by chance? if so you might consider asking support (directly or after the test and looking at the docs ;))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhm... where does the "CONTENT LENGTH" in your log come from?
it must be from https://github.com/dutchcoders/transfer.sh/pull/638/files/5d3fddfbd6610f258f441f4d3d835a650bffd5af#diff-01d6ca3cf28f771fa37e3c86cd51f957a80fd4327dfa6b4087f9b5ba4a3aaef9R73, but you also have err != nil
it seems, that must be from https://github.com/dutchcoders/transfer.sh/pull/638/files/5d3fddfbd6610f258f441f4d3d835a650bffd5af#diff-01d6ca3cf28f771fa37e3c86cd51f957a80fd4327dfa6b4087f9b5ba4a3aaef9R71, so i am a little puzzled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless you are taking it form an HEAD
request :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with a 20 minute video too and same as above (scrubs nicely but no range being used in the GET).
I also tried hard-coding in an offset, but it appears you need to pick the offsets carefully or else you corrupt the video?

I removed the range handling code, perhaps we can look at it at a later date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I need a larger video, but with 8 minute videos i'm not hitting a breakpoint inside the
if rng != nil {...}
block
and scrubbling works anyway?
can you check your network tab and see if any GET request with a content-range header is done?
let's double check the range issue one last time then i'll review the final code and approve (it seems nothing is left, at the moment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scrub.mov
Tried from b8c00d8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oki, sorry, asking for a little few more changes :)
please check my latest comments 🙏 :
The Head() request needs us to still craft a bloc client to retrieve the ContentLength. Otherwise, we can use the helpers.
finally getting around to #505 😅