mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-22 14:33:51 +00:00
fixed isProbablyBinary() on github import
This commit is contained in:
parent
59da2990b1
commit
6ac8f08e08
@ -161,6 +161,8 @@ TODO:
|
||||
- support projects with subdirectories, file list?
|
||||
- switching platform of a repo?
|
||||
- make sure to flatten subdirs
|
||||
- re-publish repo (bug: doesn't put all files in local repo after publishing)
|
||||
- allow text/binary change
|
||||
- astrocade
|
||||
- keyboard shortcuts
|
||||
- ctrl+alt+l on ubuntu locks screen
|
||||
|
@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import { FileData, Dependency, SourceLine, SourceFile, CodeListing, CodeListingMap, WorkerError, Segment, WorkerResult } from "./workertypes";
|
||||
import { getFilenamePrefix, getFolderForPath, isProbablyBinary, getBasePlatform } from "./util";
|
||||
|
@ -231,10 +231,10 @@ export class GithubService {
|
||||
var path = sess.prefix + item.path;
|
||||
var size = item.size;
|
||||
var encoding = blob.encoding;
|
||||
var isBinary = isProbablyBinary(item.path, blob);
|
||||
var data = blob.content;
|
||||
if (blob.encoding == 'base64') {
|
||||
var bindata = stringToByteArray(atob(data));
|
||||
var isBinary = isProbablyBinary(item.path, bindata);
|
||||
data = isBinary ? bindata : byteArrayToUTF8(bindata);
|
||||
}
|
||||
if (blob.size != data.length) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
export function lpad(s:string, n:number):string {
|
||||
s += ''; // convert to string
|
||||
@ -320,7 +319,7 @@ export function isProbablyBinary(path:string, data?:number[] | Uint8Array) : boo
|
||||
// check extensions
|
||||
if (path) {
|
||||
path = path.toUpperCase();
|
||||
const BINEXTS = ['.CHR','.BIN','.DAT','.PAL','.NAM','.RLE','.LZ4'];
|
||||
const BINEXTS = ['.CHR','.BIN','.DAT','.PAL','.NAM','.RLE','.LZ4','.NSF'];
|
||||
for (var ext of BINEXTS) {
|
||||
if (path.endsWith(ext)) score++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user