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
We are seeing files that upload through the SDK & APIs without a problem, but when we go to check immediately after uploading for the file's s3 download URL, it returns nothing (null or empty string). When we go and check on the UI, we also cannot download the file, so it's essentially lost.
This has been on-going for a few months now, we had some code after the SDK to check that the URL for downloading worked, and if not we would retain the file and retry later. We disabled that temporarily and found that this issue is still happening.
We did modify the UploadFileAsync slightly, but only to allow uploading by Base64.
public async Task UploadFileAsync(UploadQuery query)
{
var uploadRequest = await RequestUploadInformationAsync(new RequestUploadQuery { Filename = query.Filename }).ConfigureAwait(false);
uint chunkNumber = 0;
if (!string.IsNullOrEmpty(query.Filepath)) {
using var file = File.Open(query.Filepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); int bytesRead = 0;
var buffer = new byte[CHUNK_SIZE];
long numberOfChunks = (file.Length + CHUNK_SIZE - 1) / CHUNK_SIZE;
while ((bytesRead = file.Read(buffer, 0, buffer.Length)) > 0) {
++chunkNumber;
await UploadPartAsync(Path.GetFileName(query.Filepath), buffer, bytesRead, chunkNumber, uploadRequest, (uint)numberOfChunks).ConfigureAwait(false);
}
} else if (!string.IsNullOrEmpty(query.Base64)) {
byte[] bytes = Convert.FromBase64String(query.Base64);
using MemoryStream file = new MemoryStream(bytes); int bytesRead = 0;
var buffer = new byte[CHUNK_SIZE];
long numberOfChunks = (file.Length + CHUNK_SIZE - 1) / CHUNK_SIZE;
while ((bytesRead = file.Read(buffer, 0, buffer.Length)) > 0) {
++chunkNumber;
await UploadPartAsync(query.Filename, buffer, bytesRead, chunkNumber, uploadRequest, (uint)numberOfChunks).ConfigureAwait(false);
}
} else if (query.Filebytes != null && query.Filebytes.Length > 0) {
byte[] bytes = query.Filebytes;
using MemoryStream file = new MemoryStream(bytes); int bytesRead = 0;
var buffer = new byte[CHUNK_SIZE];
long numberOfChunks = (file.Length + CHUNK_SIZE - 1) / CHUNK_SIZE;
while ((bytesRead = file.Read(buffer, 0, buffer.Length)) > 0) {
++chunkNumber;
await UploadPartAsync(query.Filename, buffer, bytesRead, chunkNumber, uploadRequest, (uint)numberOfChunks).ConfigureAwait(false);
}
}
var finalizeResponse = await FinalizeUploadAsync(uploadRequest, chunkNumber).ConfigureAwait(false);
if (await HasFinishedSuccessfullyAsync(finalizeResponse).ConfigureAwait(false))
{
var saveMediaQuery = new SaveMediaQuery {
Filename = query.Filename,
BrandId = query.BrandId,
ImportId = finalizeResponse.ImportId,
MediaId = query.MediaId,
Tags = query.Tags,
RelatedMediaMetapropertyId = query.RelatedMediaMetapropertyId,
DepartmentMetapropertyId = query.DepartmentMetapropertyId
};
if (!string.IsNullOrEmpty(query.RelatedMediaMetapropertyId) && !string.IsNullOrEmpty(query.RelatedMediaId)) {
saveMediaQuery.RelatedMediaMetapropertyValues = new List<string> { query.RelatedMediaId };
}
if (!string.IsNullOrEmpty(query.DepartmentMetapropertyId) && !string.IsNullOrEmpty(query.Department)) {
saveMediaQuery.DepartmentMetapropertyValues = new List<string> { query.Department };
}
var savedAsset = await SaveMediaAsync(saveMediaQuery).ConfigureAwait(false);
query.MediaId = savedAsset.MediaId;
Console.WriteLine($"Uploaded File Id {savedAsset.MediaId}");
}
else
{
// need to add to a processing queue
throw new BynderUploadException("Converter did not finish. Upload not completed");
}
}
The text was updated successfully, but these errors were encountered:
Sorry for the late response on this issue. Could you try to upload a file and send me the mediaId that you get returned after uploading a file? I'd also need the portal url so I can see where the asset has gone to.
We are seeing files that upload through the SDK & APIs without a problem, but when we go to check immediately after uploading for the file's s3 download URL, it returns nothing (null or empty string). When we go and check on the UI, we also cannot download the file, so it's essentially lost.
This has been on-going for a few months now, we had some code after the SDK to check that the URL for downloading worked, and if not we would retain the file and retry later. We disabled that temporarily and found that this issue is still happening.
We did modify the UploadFileAsync slightly, but only to allow uploading by Base64.
The text was updated successfully, but these errors were encountered: