Spaces:
Runtime error
Runtime error
Update src/lib/sb-file-uploader-hoc.jsx
Browse files
src/lib/sb-file-uploader-hoc.jsx
CHANGED
@@ -111,7 +111,7 @@ const SBFileUploaderHOC = function (WrappedComponent) {
|
|
111 |
|
112 |
// pm: Some bad mobile devices block any file type (iOS)
|
113 |
if (!isMobile()) {
|
114 |
-
this.inputElement.accept = '.sb,.sb2,.sb3,.pm,.pmp';
|
115 |
}
|
116 |
|
117 |
this.inputElement.style = 'display: none;';
|
@@ -231,7 +231,7 @@ const SBFileUploaderHOC = function (WrappedComponent) {
|
|
231 |
// Don't update file handle until after confirming replace.
|
232 |
const handle = thisFileInput.handle;
|
233 |
if (handle) {
|
234 |
-
if (this.fileToUpload.name.endsWith('.pm') || this.fileToUpload.name.endsWith('.pmp')) {
|
235 |
this.props.onSetFileHandle(handle);
|
236 |
} else {
|
237 |
this.props.onSetFileHandle(null);
|
@@ -268,7 +268,7 @@ const SBFileUploaderHOC = function (WrappedComponent) {
|
|
268 |
if (!fileInputFilename) return '';
|
269 |
// only parse title with valid scratch project extensions
|
270 |
// (.sb, .sb2, and .sb3)
|
271 |
-
const matches = fileInputFilename.match(/^(.*)(\.sb[23]?|\.pm|\.pmp)$/);
|
272 |
if (!matches) return '';
|
273 |
return matches[1].substring(0, 100); // truncate project title to max 100 chars
|
274 |
}
|
|
|
111 |
|
112 |
// pm: Some bad mobile devices block any file type (iOS)
|
113 |
if (!isMobile()) {
|
114 |
+
this.inputElement.accept = '.sb,.sb2,.sb3,.pm,.pmp,s4s.txt';
|
115 |
}
|
116 |
|
117 |
this.inputElement.style = 'display: none;';
|
|
|
231 |
// Don't update file handle until after confirming replace.
|
232 |
const handle = thisFileInput.handle;
|
233 |
if (handle) {
|
234 |
+
if (this.fileToUpload.name.endsWith('.pm') || this.fileToUpload.name.endsWith('.pmp') || this.fileToUpload.name.endsWith('s4s.txt')) {
|
235 |
this.props.onSetFileHandle(handle);
|
236 |
} else {
|
237 |
this.props.onSetFileHandle(null);
|
|
|
268 |
if (!fileInputFilename) return '';
|
269 |
// only parse title with valid scratch project extensions
|
270 |
// (.sb, .sb2, and .sb3)
|
271 |
+
const matches = fileInputFilename.match(/^(.*)(\.sb[23]?|\.pm|\.pmp|\.s4s.txt)$/);
|
272 |
if (!matches) return '';
|
273 |
return matches[1].substring(0, 100); // truncate project title to max 100 chars
|
274 |
}
|