Browse Source

Check for extended ASCII characters for plaintext files (#234)

pull/235/head
Ben Letchford 5 years ago
committed by GitHub
parent
commit
d4bde37296
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/client/index.ts

2
src/client/index.ts

@ -101,7 +101,7 @@ socket.on('connect', () => {
}
// Check if the buffer is ASCII
// Ref: https://stackoverflow.com/a/14313213
else if (/^[\x00-\x7F]*$/.test(fileCharacters)) { // eslint-disable-line no-control-regex
else if (/^[\x00-\xFF]*$/.test(fileCharacters)) { // eslint-disable-line no-control-regex
mimeType = 'text/plain';
fileExt = 'txt';
}

Loading…
Cancel
Save