Skip to content

Commit a5f3a82

Browse files
committed
fix: FileSelect: text/x-basic is not ASCII
1 parent cdfba90 commit a5f3a82

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cpcbasicts",
3-
"version": "0.5.6",
3+
"version": "0.5.7",
44
"description": "# CPCBasicTS - Run CPC BASIC in a Browser",
55
"main": "./dist/cpcbasic-ui-bootstrap.js",
66
"exports": {

src/CpcVm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ export class CpcVm implements ICpcVm {
15001500
// and TXT Reset...
15011501
this.vmResetControlBuffer();
15021502
break;
1503-
case 0xbb51: // TXT Reset (ROM &11088)
1503+
case 0xbb51: // TXT Reset (ROM &1088)
15041504
this.vmResetControlBuffer();
15051505
break;
15061506
case 0xbb5a: // TXT Output (ROM &1400), depending on number of args

src/ui/FileSelect.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ export class FileSelect {
7373
name = file.name,
7474
reader = event.target;
7575
let data = (reader && reader.result) || null,
76-
type = file.type;
76+
type = "";
7777

78-
if ((type === "application/x-zip-compressed" || type === "application/zip") && data instanceof ArrayBuffer) { // on Mac OS it is "application/zip"
78+
if ((file.type === "application/x-zip-compressed" || file.type === "application/zip") && data instanceof ArrayBuffer) { // on Mac OS it is "application/zip"
7979
type = "Z";
8080
this.options.fnLoad2(new Uint8Array(data), name, type, this.imported);
8181
} else if (typeof data === "string") {
82-
if (type === "text/plain") { // "text/plain"
82+
if (file.type === "text/plain") { // "text/plain"
8383
type = "A";
8484
} else if (data.indexOf("data:") === 0) {
8585
// check for meta info in data: data:application/octet-stream;base64, or: data:text/javascript;base64,
@@ -93,7 +93,7 @@ export class FileSelect {
9393
if (info1.indexOf("base64") >= 0) {
9494
data = window.atob(data); // decode base64
9595
}
96-
if (info1.indexOf("text/") >= 0) {
96+
if ((info1.indexOf("text/") >= 0) && (info1.indexOf("text/x-basic") < 0)) { // text/x-basic is sometimes used for .bas on Linux (also with AMSDOS header)
9797
type = "A";
9898
}
9999
}

0 commit comments

Comments
 (0)