~sbaildon/transmission

9c436d87ddac1f4e15797feeb84c5eb9474a4ae6 — reardonia 1 year, 9 months ago 033d698
fix: torrentGet.wanted RPC breaking change in [4.0.0..4.0.1] (#5170)

2 files changed, 3 insertions(+), 3 deletions(-)

M docs/rpc-spec.md
M libtransmission/rpcimpl.cc
M docs/rpc-spec.md => docs/rpc-spec.md +2 -2
@@ 299,7 299,7 @@ The 'source' column here corresponds to the data structure there.
| Key | Value Type | transmission.h source
|:--|:--|:--
| `bytesCompleted` | number | tr_file_view
| `wanted` | boolean | tr_file_view
| `wanted` | number | tr_file_view (**Note:** For backwards compatibility, this is serialized as an array of `0` or `1` that should be treated as booleans)
| `priority` | number | tr_file_view

`peers`: an array of objects, each containing:


@@ 1000,4 1000,4 @@ Transmission 4.0.0 (`rpc-version-semver` 5.3.0, `rpc-version`: 17)
| `torrent-set` | :warning: **DEPRECATED** `trackerReplace`. Use `trackerList` instead.
| `group-set` | new method
| `group-get` | new method

| `wanted` | :warning: Transmission 3.00 and earlier sent this as an array of `0` or `1` despite being documented as an array of booleans. Transmission 4.0.0 and 4.0.1 "fixed" this by returning an array of booleans, but as a practical matter this caused an unannounced breaking change for 3rd party code that expects `0` or `1`. For this reason, 4.0.2 restores the 3.00 behavior and updates this spec to match the code.

M libtransmission/rpcimpl.cc => libtransmission/rpcimpl.cc +1 -1
@@ 853,7 853,7 @@ void initField(tr_torrent const* const tor, tr_stat const* const st, tr_variant*
            tr_variantInitList(initme, n);
            for (tr_file_index_t i = 0; i < n; ++i)
            {
                tr_variantListAddBool(initme, tr_torrentFile(tor, i).wanted);
                tr_variantListAddInt(initme, tr_torrentFile(tor, i).wanted);
            }
        }
        break;