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