🐛 Fix check for piece length
This commit is contained in:
parent
968e581d70
commit
a48956f504
2 changed files with 4 additions and 4 deletions
|
@ -8,8 +8,8 @@ interface ISolidFile {
|
||||||
interface ISolidFileInfo {
|
interface ISolidFileInfo {
|
||||||
/** List of files that are part of this torrent. */
|
/** List of files that are part of this torrent. */
|
||||||
files: ISolidFile[];
|
files: ISolidFile[];
|
||||||
/** Length of one piece in bytes, e.g. 4194304 for 4 MiB. */
|
/** Length of one piece in bytes, e.g. 65536 for 64 KiB, and 4194304 for 4 MiB. */
|
||||||
'piece length': number;
|
'piece length': 65536 | 4194304;
|
||||||
/** Concatenated hashes of all pieces. */
|
/** Concatenated hashes of all pieces. */
|
||||||
pieces: string;
|
pieces: string;
|
||||||
/** Whether the torrent is private, always 0. */
|
/** Whether the torrent is private, always 0. */
|
||||||
|
|
|
@ -41,8 +41,8 @@ export default function verifySolidpkg(file: ISolid, { product, from, to }: {pro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.info['piece length'] !== 4194304) {
|
if (file.info['piece length'] !== 65536 && file.info['piece length'] !== 4194304 ) {
|
||||||
throw new Error(`Expected piece length to be "4194304" but it was "${file.info['piece length']}".`);
|
throw new Error(`Expected piece length to be "65536" or "4194304" but it was "${file.info['piece length']}".`);
|
||||||
}
|
}
|
||||||
if (typeof file.info.pieces !== 'string') {
|
if (typeof file.info.pieces !== 'string') {
|
||||||
throw new Error(`Expected pieces to be a string but it was "${file.info.pieces}".`);
|
throw new Error(`Expected pieces to be a string but it was "${file.info.pieces}".`);
|
||||||
|
|
Loading…
Reference in a new issue