Repository: xbmc/xbmc
File: xbmc/guilib/guiinfo/VideoGUIInfo.cpp (C++)

Code before:
        {
          URIUtils::RemoveSlashAtEnd(value);
          value = URIUtils::GetFileName(value);
        }
        return true;
      case LISTITEM_FILENAME_AND_PATH:
      case LISTITEM_DECODED_FILENAME_AND_PATH:
        if (VIDEO::IsVideoDb(*item))
          value = tag->m_strFileNameAndPath;
        else if (item->HasMusicInfoTag()) // special handling for music videos, which have both a videotag and a musictag
          break;
        else
          value = item->GetPath();

        value = CURL(value).GetWithoutUserDetails();

        // Decode path for readability
        // Loop up to 5 times as each call to CURL::Decode() decodes one 'layer'
        // ie. bluray://udf://smb:// would require 2 passes to make fully human-readable
        if (info.m_info == LISTITEM_DECODED_FILENAME_AND_PATH)
          for (unsigned int i = 0; i < MAX_DECODE_PASSES; ++i)
          {
            if (value.find('%') != std::string::npos)
              value = CURL::Decode(value);
            else
              break;
          }

        return true;
      case LISTITEM_VIDEO_HDR_TYPE:
        value = tag->m_streamDetails.GetVideoHdrType();
        return true;
      case LISTITEM_LABEL:
      {
        //! @todo get rid of "videos with versions as folder" hack!

        // special casing for "show videos with multiple versions as folders", where the label
        // should be the video version, not the movie title.
        if (!item->HasVideoVersions())
          break;

        CGUIWindow* videoNav{
            CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_VIDEO_NAV)};
        if (videoNav && videoNav->GetProperty("VideoVersionsFolderView").asBoolean() &&
            videoNav->IsActive())
        {
          value = tag->GetAssetInfo().GetTitle();
          return true;
        }
        break;
      }

Review comment (suggestion):
I meant this:
```suggestion
          for (unsigned int i = 0; value.find('%') == std::string::npos && i < MAX_DECODE_PASSES; ++i)
              value = CURL::Decode(value);
```

Code after:
          value = URIUtils::GetFileName(value);
        }
        return true;
      case LISTITEM_FILENAME_AND_PATH:
      case LISTITEM_DECODED_FILENAME_AND_PATH:
        if (VIDEO::IsVideoDb(*item))
          value = tag->m_strFileNameAndPath;
        else if (item->HasMusicInfoTag()) // special handling for music videos, which have both a videotag and a musictag
          break;
        else
          value = item->GetPath();

        value = CURL(value).GetWithoutUserDetails();

        // Decode path for readability
        // Loop up to MAX_DECODE_PASSES times as each call to CURL::Decode() decodes one 'layer'
        // ie. bluray://udf://smb:// would require 2 passes to make fully human-readable
        if (info.m_info == LISTITEM_DECODED_FILENAME_AND_PATH)
        {
          static constexpr unsigned int MAX_DECODE_PASSES = 5;
          for (unsigned int i = 0; value.find('%') != std::string::npos && i < MAX_DECODE_PASSES;
               ++i)
            value = CURL::Decode(value);
        }

        return true;
      case LISTITEM_VIDEO_HDR_TYPE:
        value = tag->m_streamDetails.GetVideoHdrType();
        return true;
      case LISTITEM_LABEL:
      {
        //! @todo get rid of "videos with versions as folder" hack!

        // special casing for "show videos with multiple versions as folders", where the label
        // should be the video version, not the movie title.
        if (!item->HasVideoVersions())
          break;

        CGUIWindow* videoNav{
            CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_VIDEO_NAV)};
        if (videoNav && videoNav->GetProperty("VideoVersionsFolderView").asBoolean() &&
            videoNav->IsActive())
        {
          value = tag->GetAssetInfo().GetTitle();
          return true;
        }
        break;
      }
    }
  }