Skip to content

Commit

Permalink
An error occured while loading renamed picture for checked out PR (#6033
Browse files Browse the repository at this point in the history
)

* An error occured while loading renamed picture for checked out PR
Fixes #6008

* Merge branch `main` into alexr00/issue6008
  • Loading branch information
alexr00 committed Jun 17, 2024
1 parent 1ccc084 commit a3f9083
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/common/uri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,17 @@ export async function asTempStorageURI(uri: vscode.Uri, repository: Repository):
return;
}
const ref = uri.scheme === Schemes.Review ? commit : isBase ? baseCommit : headCommit;
const { object } = await repository.getObjectDetails(ref, uri.fsPath);

const absolutePath = pathUtils.join(repository.rootUri.fsPath, path).replace(/\\/g, '/');
const { object } = await repository.getObjectDetails(ref, absolutePath);
const { mimetype } = await repository.detectObjectType(object);

if (mimetype === 'text/plain') {
return;
}

if (ImageMimetypes.indexOf(mimetype) > -1) {
const contents = await repository.buffer(ref, uri.fsPath);
const contents = await repository.buffer(ref, absolutePath);
return TemporaryState.write(pathUtils.dirname(path), pathUtils.basename(path), contents);
}
} catch (err) {
Expand Down

0 comments on commit a3f9083

Please sign in to comment.