Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several issues #25

Open
razaqq opened this issue Apr 11, 2023 · 1 comment
Open

Several issues #25

razaqq opened this issue Apr 11, 2023 · 1 comment

Comments

@razaqq
Copy link

razaqq commented Apr 11, 2023

There is a whole range of bugs and missing things, ill try to summarize them here in one

  • BININT2 (opcode 77) is missing, should be uint16_t
  • you should be using wstring often times, because torrent names/files can contain unicode characters
  • here you should be adding
        if (i >= box.Files.size())
            break;

for me it was the case that filePriorities.size() > box.Files.size() for multiple torrents, causing an array out of range access and thus crash

  • Files renamed in deluge dont transfer their name into transmission
  • File priorities (including skip) dont transfer from deluge into transmission
  • Various string_view and constexpr missing, not that important
  • this is not going to work on windows, because it includes the character : from the timestamp in the filename, which is not allowed. You could replace it with some other character like this
static std::string ReplaceAll(std::string_view str, std::string_view before, std::string_view after)
{
    std::string newString;
    newString.reserve(str.length());

    size_t i = 0, j = 0;

    while ((i = str.find(before, j)) != std::string_view::npos)
    {
        newString.append(str, j, i - j);
        newString.append(after);
        j = i + before.length();
    }

    newString.append(str.substr(j));

    return newString;
}

fs::path MigrationTransaction::GetTemporaryPath(fs::path const& path) const
{
    fs::path result = path;
    result += ".tmp." + ReplaceAll(m_transactionId, ":", "-");
    return result;
}

fs::path MigrationTransaction::GetBackupPath(fs::path const& path) const
{
    fs::path result = path;
    result += ".bak." + ReplaceAll(m_transactionId, ":", "-");
    return result;
}
@mikedld
Copy link
Owner

mikedld commented Apr 11, 2023

I appreciate your interest in the project, but as before please prefer multiple targeted PRs instead of a single big one with all the changes ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants