Skip to content

Commit

Permalink
Handle cloud storage file extensions with versioning.
Browse files Browse the repository at this point in the history
If a user uses its own IOSystem/IOStream for handling google cloud
storage or aws s3 uris, with this PR the extension will still be correct.
  • Loading branch information
feuerste committed Jun 27, 2023
1 parent 41e2b0f commit 1120c8d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/Common/BaseImporter.cpp
Expand Up @@ -267,6 +267,12 @@ std::string BaseImporter::GetExtension(const std::string &file) {
std::string ret = file.substr(pos + 1);
ret = ai_tolower(ret);

// gcs uris (e.g. `gs://bucket/obj.glb#1234`) or aws s3 uris (e.g. `s3://bucket/obj.glb#NULL`)
// can have a version string at the end, remove it as well,
// so an underlying IOSystem/IOStream supporting gcs or aws s3 can handle it
// (see https://github.com/GoogleCloudPlatform/gsutil/blob/c80f329bc3c4011236c78ce8910988773b2606cb/gslib/storage_url.py#L39-L42)
ret = ret.substr(0, ret.find_last_of('#'));

return ret;
}

Expand Down

0 comments on commit 1120c8d

Please sign in to comment.