-
-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit file extensions to be imported into a document #1520
Conversation
…ONS` This should reduce the possibility that our users will attempt to import the wrong kind of file.
28191b0
to
9b17781
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a naming comment.
app/client/lib/uploads.ts
Outdated
@@ -31,6 +31,9 @@ export interface SelectFileOptions extends UploadOptions { | |||
// e.g. [".jpg", ".png"] | |||
} | |||
|
|||
// This list coincides with the extensions defined in core/plugins/manifest.yml | |||
export const IMPORTABLE_TABLE_EXTENSIONS = [".xlsx", ".json", ".csv", ".tsv", "dsv"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The relationship between IMPORTABLE_EXTENSIONS
and IMPORTABLE_TABLE_EXTENSIONS
is a bit confusing. The word TABLE suggests one of them might be for single table imports, but that isn't the case for .xlsx and .json
Maybe the distinction is more like IMPORTABLE_AS_DOC_EXTENSIONS
and IMPORTABLE_WITHIN_DOC_EXTENSIONS
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've made that change.
…DOC` We're going to have two different kinds of importable extensions, so let's rename these to be more consistent with their purpose
What makes sense to import into a document isn't the same as what makes sense for importing as a whole document.
e1f5b27
to
0289e3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems almost good to me!
There just seem to be a typo (as file specifiers using extensions should always start with dots).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jordigh !
c5e193d
to
dd73feb
Compare
Context
Users have tried using the importer to add tables to an existing document, but without any indication of which file types are available for import, users may upload an incompatible file type and hit an error message.
Proposed solution
Limit the file picker to only the
table-level
importable file types, analogous to the limits imposed on the document-level importable types.Original commit messages:
d917f5f uploads: add new constant, IMPORTABLE_TABLE_EXTENSIONS
What makes sense to import into a document isn't the same as what
makes sense for importing as a whole document.
28191b0 Importer: limit list of acceptable files to
IMPORTABLE_TABLE_EXTENSIONS
This should reduce the possibility that our users will attempt to
import the wrong kind of file.
Has this been tested?
We don't have tests for OS-level dialogues that the web browser could open, so instead I did some manual testing to ensure that the dialogue only allows uploading this restricted set of file types.
Screenshots / Screencasts
uploads.mp4