mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
Fix http json loading
This commit is contained in:
parent
c2b78951a7
commit
7774a2a14a
@ -93,7 +93,9 @@ export const Drives = ({ cpu, io, sectors, enhanced, ready }: DrivesProps) => {
|
||||
for (const drive of [1, 2] as DriveNumber[]) {
|
||||
if (hashParts && hashParts[drive]) {
|
||||
const hashPart = decodeURIComponent(hashParts[drive]);
|
||||
if (hashPart.match(/^https?:/)) {
|
||||
const isHttp = hashPart.match(/^https?:/i);
|
||||
const isJson = hashPart.match(/\.json$/i);
|
||||
if (isHttp && !isJson) {
|
||||
loading++;
|
||||
controllers.push(spawn(async (signal) => {
|
||||
try {
|
||||
@ -113,7 +115,7 @@ export const Drives = ({ cpu, io, sectors, enhanced, ready }: DrivesProps) => {
|
||||
setTotal(0);
|
||||
}));
|
||||
} else {
|
||||
const url = `/json/disks/${hashPart}.json`;
|
||||
const url = isHttp ? hashPart : `/json/disks/${hashPart}.json`;
|
||||
loadJSON(disk2, drive, url).catch((e) => setError(e));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user