Skip to content

Commit

Permalink
feat(ark-metadata): add file extension to filename when uploading to …
Browse files Browse the repository at this point in the history
…S3 (#445)
  • Loading branch information
remiroyc authored Sep 10, 2024
1 parent f95b245 commit 28ff5c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/ark-metadata/src/metadata_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,15 @@ impl<'a, T: Storage, C: StarknetClient, F: FileManager, E: ElasticsearchManager>
let (file_name, content_type) = if last_part.contains('.') {
if let Some(file_extension) = last_part.split('.').last() {
let content_type = get_content_type_from_extension(file_extension);
(file_extension.to_string(), content_type.to_string())
(last_part.to_string(), content_type.to_string())
} else {
return Err(anyhow!("Failed to extract file extension from URL"));
}
} else {
match file_extension_from_mime_type(content_type_from_headers.as_str()) {
Some(file_extension) => {
let file_name = format!("{}.{}", token_id, file_extension);
(file_name, file_extension.to_string())
let name = format!("{}.{}", token_id, file_extension);
(name, file_extension.to_string())
}
None => (token_id.to_string(), content_type_from_headers),
}
Expand Down

0 comments on commit 28ff5c0

Please sign in to comment.