-
Notifications
You must be signed in to change notification settings - Fork 412
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
#10770: Vector files import limits #10772
base: master
Are you sure you want to change the base?
Conversation
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.
@mahmoudadel54 please update this PR by aligning it to master branch.
Description: - handle checking the file size for imported vector layers only - show a warning notification for each layer has size larger than the configurable limit if configured - add translations - add test units
Description: - add enhancements to the code including some helpful comments
Description: - rename the configurable prop name of vector max size to 'importedVectorFileMaxSizeInMB' instead of 'importedVectorFileSizeInMB' to be more meaningful
6de5413
to
3479a25
Compare
Done |
@@ -66,6 +67,16 @@ const checkFileType = (file) => { | |||
const readFile = (onWarnings) => (file) => { | |||
const ext = recognizeExt(file.name); | |||
const type = file.type || MIME_LOOKUPS[ext]; | |||
// Check the file size first before file conversion process to avoid this useless effort | |||
const configurableFileSizeLimitInMB = getConfigProp('importedVectorFileMaxSizeInMB'); |
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.
what is the default limit ? i think we need to force one default value and not leave it without any limit.
if it was not decided we can make 2 MB
Also i think is better to have this prop as part of MapImport plugin
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.
@tdipisa do you agree ?
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.
@MV88 @mahmoudadel54 just a note, I did a test and it seems possible to pass the max size property as cfg of MapImport, I modified following files:
export default compose(
processFiles,
useFiles,
dropZoneHandlers
)(
({
onClose = () => {},
onDrop = () => {},
onRef = () => {},
...props
}) => <DragZone
onClose={onClose}
onDrop={(files) => onDrop({ files, options: { importedVectorFileMaxSizeInMB: props.importedVectorFileMaxSizeInMB } })}
onRef={onRef}
>
<Content {...props} />
</DragZone>);
drop$.switchMap(
({ files, options }) => Rx.Observable.from(files)
.flatMap(checkFileType) // check file types are allowed
.flatMap(readFile({ onWarnings, options })) // read files to convert to json
could you give it a try before using the getConfigProp
?
Description
This PR handles checking on imported vector files size if a confugrable prop is existing into localConfig.
This PR introduces a performed check by MS to verify if imported vector files are over a certain (configurable) file size.
The size limit is allowed now to be configurable into localConfig by prop called 'importedVectorFileMaxSizeInMB' and its value is number of megabytes. If the file is exceeding the max limit, a warning notification is shown to user.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
#10770
What is the current behavior?
#10770
What is the new behavior?
If 'importedVectorFileMaxSizeInMB' is added into localConfig, and user wants to upload vector files with size larger that 'importedVectorFileMaxSizeInMB' it will show a warning notification about exceeding the max file size.
2025-01-22.21-55-56.mp4
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information