Fix 7z archives with spaces (#288)

* fix: ignore imported versions

* fix: bump droplet for 7z fixes
This commit is contained in:
DecDuck
2025-11-20 03:02:56 +00:00
committed by GitHub
parent beb824c8d9
commit 2ae7f41be0
8 changed files with 71 additions and 63 deletions

View File

@ -105,7 +105,10 @@ class LibraryManager {
if (!game) return undefined;
try {
const versions = await provider.listVersions(libraryPath);
const versions = await provider.listVersions(
libraryPath,
game.versions.map((v) => v.versionName),
);
const unimportedVersions = versions.filter(
(e) =>
game.versions.findIndex((v) => v.versionName == e) == -1 &&

View File

@ -24,7 +24,10 @@ export abstract class LibraryProvider<CFG> {
* @param game folder name of the game to list versions for
* @returns list of version folder names
*/
abstract listVersions(game: string): Promise<string[]>;
abstract listVersions(
game: string,
existingPaths?: string[],
): Promise<string[]>;
/**
* @param game folder name of the game

View File

@ -54,11 +54,15 @@ export class FilesystemProvider
return folderDirs;
}
async listVersions(game: string): Promise<string[]> {
async listVersions(
game: string,
ignoredVersions?: string[],
): Promise<string[]> {
const gameDir = path.join(this.config.baseDir, game);
if (!fs.existsSync(gameDir)) throw new GameNotFoundError();
const versionDirs = fs.readdirSync(gameDir);
const validVersionDirs = versionDirs.filter((e) => {
if (ignoredVersions && ignoredVersions.includes(e)) return false;
const fullDir = path.join(this.config.baseDir, game, e);
return DROPLET_HANDLER.hasBackendForPath(fullDir);
});
@ -109,17 +113,12 @@ export class FilesystemProvider
) {
const filepath = path.join(this.config.baseDir, game, version);
if (!fs.existsSync(filepath)) return undefined;
let stream;
while (!(stream instanceof ReadableStream)) {
const v = DROPLET_HANDLER.readFile(
filepath,
filename,
options?.start ? BigInt(options.start) : undefined,
options?.end ? BigInt(options.end) : undefined,
);
if (!v) return undefined;
stream = v.getStream() as ReadableStream<unknown>;
}
const stream = DROPLET_HANDLER.readFile(
filepath,
filename,
options?.start ? BigInt(options.start) : undefined,
options?.end ? BigInt(options.end) : undefined,
);
return stream;
}

View File

@ -112,7 +112,7 @@ export class FlatFilesystemProvider
);
if (!stream) return undefined;
return stream.getStream();
return stream;
}
fsStats() {