Skip to content

Commit

Permalink
fix: temp svn fs changed output content type to Buffer to preserve en…
Browse files Browse the repository at this point in the history
…coding-specific characters (#836)
  • Loading branch information
Blashaq committed Feb 21, 2020
1 parent 5fcedeb commit f076e64
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/temp_svn_fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,12 @@ class TempSvnFs implements FileSystemProvider, Disposable {
const hash = crypto.createHash("md5");
const filePathHash = hash.update(svnUri.path).digest("hex");
const encoding = configuration.get<string>("default.encoding");
let contentBuffer: Buffer;

if (encoding) {
content = iconv.encode(content, encoding).toString();
contentBuffer = iconv.encode(content, encoding);
} else {
contentBuffer = Buffer.from(content);
}

if (!this._root.entries.has(filePathHash)) {
Expand All @@ -211,7 +214,7 @@ class TempSvnFs implements FileSystemProvider, Disposable {

const uri = Uri.parse(`tempsvnfs:/${filePathHash}/${fname}`, true);

this.writeFile(uri, Buffer.from(content), {
this.writeFile(uri, contentBuffer, {
create: true,
overwrite: true
});
Expand Down

0 comments on commit f076e64

Please sign in to comment.