Skip to content

Commit f540e02

Browse files
committed
correctly transform uint8array to string
1 parent c064673 commit f540e02

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: arduino-ide-extension/src/browser/create/create-api.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { AuthenticationClientService } from '../auth/authentication-client-servi
55
import { ArduinoPreferences } from '../arduino-preferences';
66
import { SketchCache } from '../widgets/cloud-sketchbook/cloud-sketch-cache';
77
import { Create, CreateError } from './typings';
8+
import * as util from 'util';
89

910
export interface ResponseResultProvider {
1011
(response: Response): Promise<any>;
@@ -277,7 +278,7 @@ export class CreateApi {
277278
const secrets = (
278279
typeof content === 'string'
279280
? content
280-
: new TextDecoder().decode(content)
281+
: new util.TextDecoder('utf8').decode(content)
281282
)
282283
.split(/\r?\n/)
283284
.reduce((prev, curr) => {
@@ -341,7 +342,9 @@ export class CreateApi {
341342
const headers = await this.headers();
342343

343344
let data: string =
344-
typeof content === 'string' ? content : new TextDecoder().decode(content);
345+
typeof content === 'string'
346+
? content
347+
: new util.TextDecoder().decode(content);
345348
data = await this.toggleSecretsInclude(posixPath, data, 'remove');
346349

347350
const payload = { data: btoa(data) };

0 commit comments

Comments
 (0)