Conversation
0e955f9 to
1e0eb05
Compare
Merged
1e0eb05 to
74d5023
Compare
crazytonyli
reviewed
May 6, 2025
| } | ||
| public func uploadMedia(mediaUploadRequest: MediaUploadRequest) async throws -> WpNetworkResponse { | ||
| let urlrequest = try await mediaUploadRequest.asUrlRequest() | ||
| let (_, response) = try await self.fetch(request: self.preflight(urlrequest)) |
Contributor
There was a problem hiding this comment.
URLSession.uploadTask is probably more appropriate for uploading media. We can choose to stream from a file or memory. Things may go wrong when users choose to upload a video if we always read the file content into memory.
Contributor
Author
There was a problem hiding this comment.
We're not currently reading the file into memory – instead, we make a file that contains the entire request body then provide that as an InputStream on the URLRequest.
It might make sense to separate binary upload from the file metadata though, in which case we could definitely use an upload task
Contributor
Author
|
Closing in favour of #717 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.