Fix #159001: Remote Asset Library duplicate assets after refresh

When refreshing a remote asset library, already downloaded assets would
appear twice on Windows, with one being the downloaded version and the
other being the remote version.

This was because when checking if an asset had already been downloaded,
`filelist_readjob_remote_asset_library_index_read` constructed a
library-relative identifier with the path from
`OnlineAssetInfo::asset_file()`. But as relative identifiers use native
slashes and `asset_file()` uses forward slashes, the relative identifier
wouldn't match the one of the already downloaded asset on Windows, which
caused the remote asset to be listed even when already downloaded.

Fixed by converting the returned path to native slashes before using it
to look for a downloaded asset.

Pull Request: https://projects.blender.org/blender/blender/pulls/160431
This commit is contained in:
Jorn Visser 2026-06-26 15:56:18 +02:00 • committed by Julian Eisel
parent acf58afbb5
commit df382ffced

View file

@ -70,9 +70,12 @@ static void filelist_readjob_remote_asset_library_index_read(
/* For assets already on disk, stamp the listing's file status onto the existing
* AssetRepresentation so the UI can reflect whether it is up to date. */
const StringRefNull asset_file = entry.online_info.asset_file();
std::string asset_file = entry.online_info.asset_file();
/* Relative identifiers use native slashes, but #asset_system::OnlineAssetInfo::asset_file()
* has forward slashes instead, so they need to be converted to native. */
BLI_path_slash_native(asset_file.data());
{
BLI_assert(asset_file.endswith(".blend"));
BLI_assert(asset_file.ends_with(".blend"));
/* Matches #asset_system::AssetRepresentation.library_relative_identifier(). */
char asset_identifier[FILE_MAX_LIBEXTRA];