-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: use selected format instead of file extension for Content-Type header #50
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.
Code changes look good. 💯 for the variable name formattedFormat
However, when running the branch locally, I see there are some issues. Some seemed to be present on master too, but others seemed to have popped up now:
- When the format (chosen in the UI) and the actual file type don't match, I don't get a warning about this. Instead, I have to read in the collapsed logger what's gone wrong. In the meanwhile, the progress indicator keeps spinning. In the master branch this type of scenario seemed to be handled better. Is there a way you could implement the current changes, but still keep the errors as they were on master?
- I don't think this has anything to do with your changes, because I get this on master too, but when an import is done, the progress bar just keeps going....
I've carried on testing by just using my local (docker based) dhis2-core instance and running the app in dev mode. Most of this app seems to be broken. And this seems to be the case both on master as well as on this branch. And I have never worked on this app before, so I am not aware of any gotchas or limitations. As such, it is impossible for me to review this PR: I don't know what is supposed to be working and what is supposed to be broken (locally). |
Haha didn't know any better name, it does sound funny though!
The current version on master checks the type by extracting it from the file name.
So I'm not sure what you saw, can you give me a description how to reproduce? Ideally with
https://jira.dhis2.org/browse/DHIS2-7221
I don't know what you mean by this? Do you see the same behavior on the play versions? Or just the local version? (To find the import export app on play.dhis2.org/dev, you'll need to log in with the system user, not admin). |
I don't suspect so. I tried to touch as little as possible of the app's internals, so there shouldn't be any significant changes other than bundling etc. I did notice however, during this PR and before, that the app seems to be a lot more complicated than its functionality would warrant. I can imagine bugs crop up in this app because the logic is tricky to follow. |
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.
Apologies. It turned out that a lot of the problems I was seeing were due to limitation on my local dhis2-core instance. Once I switched to a the play/dev backend I was able to successfully test the current issue. All was fine.
Fixes DHIS2-6247 Backports #50
Fixes DHIS2-6247 Backports #50
Fixes DHIS2-6247 Backports #50
# 1.0.0 (2020-11-30) ### Bug Fixes * **assigned-user-mode:** add left margin to user picker ([c0391f9](c0391f9)) * **assigned-user-mode:** shorten text and remove one header ([f787f73](f787f73)) * **data/tei-export:** send attachment parameter ([6a6be58](6a6be58)) * **job-overview:** add responsivness ([1006514](1006514)) * **job-overview:** unselect selected job if filtered out ([4c749e8](4c749e8)) * **job-summary:** update wording ([6cd26ea](6cd26ea)) * **tei-export:** only include `assignedUser` when user filter is on ([7a58940](7a58940)) * **tei-export/assigned-user-mode:** add option to disable this filter ([a2ca740](a2ca740)) * **tei-export/org-unit-mode:** correctly show ouMode overrides ([5f8f7f8](5f8f7f8)) * **tei-import:** remove async option and keep all imports sync ([c4fa2ee](c4fa2ee)) * **translations:** sync translations from transifex (master) ([b921c25](b921c25)) * **translations:** sync translations from transifex (master) ([e13ee77](e13ee77)) * **translations:** sync translations from transifex (master) ([269b697](269b697)) * **translations:** sync translations from transifex (master) ([11fcd88](11fcd88)) * **translations:** sync translations from transifex (master) ([d4f8f39](d4f8f39)) * **translations:** sync translations from transifex (master) ([49c1165](49c1165)) * **translations:** sync translations from transifex (master) ([58b8a7a](58b8a7a)) * **translations:** sync translations from transifex (master) ([02abac6](02abac6)) * **translations:** sync translations from transifex (master) ([ff4990e](ff4990e)) * **translations:** sync translations from transifex (master) ([4dd1190](4dd1190)) * **translations:** sync translations from transifex (master) ([4ae25ed](4ae25ed)) * **translations:** sync translations from transifex (master) ([10e1263](10e1263)) * **translations:** sync translations from transifex (master) ([f3a698d](f3a698d)) * **translations:** sync translations from transifex (master) ([f55fb7c](f55fb7c)) * **translations:** sync translations from transifex (master) ([294d85e](294d85e)) * **translations:** sync translations from transifex (master) ([45ae4be](45ae4be)) * **translations:** sync translations from transifex (master) ([da63dba](da63dba)) * **translations:** sync translations from transifex (master) ([48096ae](48096ae)) * **translations:** sync translations from transifex (master) ([e5e7b91](e5e7b91)) * **translations:** sync translations from transifex (master) ([5accbf2](5accbf2)) * **translations:** sync translations from transifex (master) ([672ba67](672ba67)) * **translations:** sync translations from transifex (master) ([0961e22](0961e22)) * **translations:** sync translations from transifex (master) ([3f240df](3f240df)) * **translations:** sync translations from transifex (master) ([934ef2c](934ef2c)) * **translations:** sync translations from transifex (master) ([2c56ff3](2c56ff3)) * **translations:** sync translations from transifex (master) ([ca82c53](ca82c53)) * corrects capitalization of data-element-id-scheme labels ([7e6ebcf](7e6ebcf)) * **translations:** sync translations from transifex (master) ([df84baa](df84baa)) * **translations:** sync translations from transifex (master) ([f068a1b](f068a1b)) * **translations:** sync translations from transifex (master) ([96df50d](96df50d)) * **translations:** sync translations from transifex (master) ([653c960](653c960)) * **translations:** sync translations from transifex (master) ([11ec0a2](11ec0a2)) * make FormAlerts component purely functional ([cfef938](cfef938)) * **cypress:** correctly use environment file ([34d917b](34d917b)) * **export:** open download url in a new tab ([86c17ea](86c17ea)) * **i18n:** correctly handle colon ([d000b47](d000b47)) * **i18n:** correctly import translations ([076e166](076e166)) * **import-job-creation:** correctly set isAsync property ([c7fd0a2](c7fd0a2)) * **jest:** css moduleNameMapper ([1853684](1853684)) * **labels/strategy:** delete label description ([ac0916c](ac0916c)) * **org-unit-tree:** add max-height ([dc3fbef](dc3fbef)) * **tei-export:** add download flag and add compression type to url ([91594cc](91594cc)) * **tei-export:** correctly check programStatus form value ([38885e8](38885e8)) * **tei-import:** extract the report correctly when job is synchronous ([b3afa48](b3afa48)) * **tei-import:** use strategy instead of importStrategy ([be207dc](be207dc)) * **translations:** sync translations from transifex (master) ([880f1e9](880f1e9)) * correcly check date falsy value ([ff1fdea](ff1fdea)) * give event table rows unique keys ([e8284b8](e8284b8)) * set proper default values for checkbox inputs ([1a40055](1a40055)) * **cypress:** temporarily remove cli-utils-cypress support import ([d330d18](d330d18)) * **cypress:** update dynamic attribute tests ([4cc2041](4cc2041)) * **event export:** parameter name typo ([63fe47e](63fe47e)) * **failing tests:** required `label` prop ([584a528](584a528)) * **tei-import:** show import strategy delete warning ([b68196b](b68196b)) * **translations:** sync translations from transifex (master) ([9276a61](9276a61)) * **translations:** sync translations from transifex (master) ([562bd5d](562bd5d)) * **translations:** sync translations from transifex (master) ([e1a8b4f](e1a8b4f)) * **translations:** sync translations from transifex (master) ([cbe9633](cbe9633)) * **translations:** sync translations from transifex (master) ([000abfd](000abfd)) * **translations:** sync translations from transifex (master) ([067f358](067f358)) * **ui:** position alerts fixed in the center of the screen ([1680894](1680894)) * **ui:** prefix long labels with keywords used in previous versions ([c2470e0](c2470e0)) * **ui:** styling adjustments according to ui-review([#668](#668)) ([bb0d309](bb0d309)) * add export form validation ([a25922a](a25922a)) * adjust tests to new style and fix found refactoring bugs ([4f76870](4f76870)) * app-platform core-app ([a2e4250](a2e4250)) * assign download url correctly ([da0f575](da0f575)) * correctly pass typeReport on error ([7396cf6](7396cf6)) * critical warning alert when server returns an error on POST ([222386a](222386a)) * don't crash if server returns null summary ([4c89958](4c89958)) * don't postfix app name in manifest ([cd6c6be](cd6c6be)) * **ui:** select/clear all checkboxes converted to buttons ([cde22b8](cde22b8)) * csv format check ([83c9b20](83c9b20)) * error handling IdScheme ([26adf20](26adf20)) * error when conditionally rendering fields ([63d1fbd](63d1fbd)) * eslint build error work-around ([4192630](4192630)) * failing Schemas test ([#42](#42)) ([703579f](703579f)) * failing test ([9bdd3f6](9bdd3f6)) * failing test. Update UI dep ([01cbdbe](01cbdbe)) * fossa readme badge ([6dd48bd](6dd48bd)) * global element schema context ([95ece0b](95ece0b)) * global user context ([ef8df5b](ef8df5b)) * handle all xhr errors ([fcb230e](fcb230e)) * handle HTTP errors when fetching attributes ([bc036fe](bc036fe)) * handle query errors ([07ca351](07ca351)) * handle unknown api response shape ([#62](#62)) (DHIS2-7207) ([e35c55f](e35c55f)) * id is always string ([7f3053b](7f3053b)) * import pages progress bar ([3764e6d](3764e6d)) * job overview initial render bug ([c1d3d54](c1d3d54)) * label as prop ([e5338b8](e5338b8)) * label uppercase ([cb2b37a](cb2b37a)) * make location assignment functionality stubbable ([12c6116](12c6116)) * move common select logic to SelectableList ([c6d0ede](c6d0ede)) * move internal components to separate subfolders ([ee55277](ee55277)) * move schema logic inside components ([0947fed](0947fed)) * move user, scheme and task logic to HOCs ([3d27c33](3d27c33)) * multiselect correctly works when turned off ([0daf8a5](0daf8a5)) * no import summaries ([26d03b7](26d03b7)) * page supports progress in percentage ([2ec221a](2ec221a)) * param generation ([79b3279](79b3279)) * progress in correctly set ([6398c92](6398c92)) * react-final-forms form-errors subscription ([534b843](534b843)) * remove error message print from i18n ([c518ecb](c518ecb)) * rename more appropriately ([8924fa6](8924fa6)) * renamed to SelectableList ([3633888](3633888)) * select/clear all only makes sense when multi-select ([ca06169](ca06169)) * setSelected doesn't need current state value ([7c87233](7c87233)) * state updates on unmounted component ([07b27f5](07b27f5)) * tag tasks that have error events as erroneous ([382a0c8](382a0c8)) * tag tasks that have error in task-summary as erroneous ([caa7f5c](caa7f5c)) * test check i18n string ([7192b02](7192b02)) * unique keys when duplicate object names ([9505b09](9505b09)) * use onComplete/onError callback functions ([8c5c7b9](8c5c7b9)) * **api helper:** extract correct name in getProgramStages helper ([7412dff](7412dff)) * **css:** overflow ([2f9efb8](2f9efb8)) * **data import:** add missing skip audit request parameter ([#60](#60)) (DHIS2-7020) ([5f2217c](5f2217c)) * **import meta data:** send correct file format ([7628b4c](7628b4c)) * **metadata dependency:** use objectType and objectList in url ([#76](#76)) ([ffa66bc](ffa66bc)) * add crossorigin to fix chrome-bug (fixes DHIS2-6122) ([59a56d5](59a56d5)) * **metadata export:** filter selectable schemas on metadata and exclude schemas ([#30](#30)) ([587bbfb](587bbfb)) * clear log fix ([6d90210](6d90210)) * label used before it was defined ([61d2c98](61d2c98)) * show summary after data imports ([61d4ef6](61d4ef6)) * use selected format instead of file extension for Content-Type header ([#50](#50)) ([cf9cfb3](cf9cfb3)) * **add/remove:** org unit ([0a19acf](0a19acf)) * **code-style:** eslint configuration issues ([cfae816](cfae816)) * **DataExport:** fix default True, include descendant of org. unit ([355f7fc](355f7fc)) * **Date:** component ([15c2c27](15c2c27)) * **eslint-loader:** add dependency ([5da95e8](5da95e8)) * **EventImport:** reference to getParamsFromFormState func. in helpers ([23b9cd2](23b9cd2)) * **logger:** remove truncation of date in logger ([f3a8aaf](f3a8aaf)) * **metadata-export:** add support for csv. Download directly from server ([becd9cd](becd9cd)) * remove xhr onprogress code ([a521338](a521338)) * upgrade d2/ui, fix import to reduce bundle-size ([3cfefb6](3cfefb6)) * **getFormValues:** add exception for calculated values ([4a10865](4a10865)) * **getMimeType:** return NULL if filename is empty ([d9acced](d9acced)) * **HeaderBar:** enable HeaderBaR ([f358718](f358718)) * **logger:** add placeholder to messages without timestamp ([fa8f427](fa8f427)) * **logger:** Add truncation options to getDate ([f3078d7](f3078d7)) * **Metadata Import:** append object type if format is CSV ([ffd4794](ffd4794)) * **metadata-dep:** fix optionset support ([20bb9e7](20bb9e7)), closes [#DHIS2-6074](https://github.com/dhis2/import-export-app/issues/DHIS2-6074) * **MetadataDependencyExport:** missing ObjectType field ([643bcc5](643bcc5)) * **MetadataExport:** amend skipSharing param when sharing = false ([910413f](910413f)) * **MetadataExport:** send list of exclude params ([137bde7](137bde7)) * **MetadataImport:** duplicate ObjectType field ([14928f8](14928f8)) * **MetaDataImport:** set response to json ([99c15b6](99c15b6)) * check data response before logging stats ([1b20bad](1b20bad)) * use format json, in MetaData & MetaDataDependency import/export ([5d65d03](5d65d03)) * **metadata dependency export:** repeated api/api in url ([0a9436a](0a9436a)) * **RadioButton:** set default valueSelected ([8638240](8638240)) * **rxjs:** include dependency for headerbar ([77ae860](77ae860)) * **syntax:** use map instead of forEach ([227d779](227d779)) * **Tree:** sibling sub-tree expand ([ba261db](ba261db)) * **xhr setRequestHeader:** open XHR before setting headers ([3d6968f](3d6968f)) * add format param for Export for correct server export ([9d1c9a9](9d1c9a9)) * blob mime types ([7dde8cd](7dde8cd)) * enable HeaderBar ([dc59375](dc59375)) * enable HeaderBar ([3e3da0b](3e3da0b)) * fetchLog first param ([8e95750](8e95750)) * use prop name as name ([490548a](490548a)) * **schemas:** Component ([10ca642](10ca642)) * **SelectField:** layout and selection issues ([52bc7c5](52bc7c5)) * **tasksummary:** add check for errorReports ([ec81d52](ec81d52)) ### Features * ability to hide task details ([cde23f5](cde23f5)) * add dynamic attributes to data & event import page ([#68](#68)) (DHIS2-7495) ([f9a64bf](f9a64bf)) * add home page ([83fc914](83fc914)) * component DatePicker tests ([b7f267b](b7f267b)) * component FormField tests ([3034d77](3034d77)) * component Icon tests ([11030e0](11030e0)) * component ImportButtonStrip tests ([4b6d69f](4b6d69f)) * component JobSummary ([fb5ec44](fb5ec44)) * dry run as primary form submit button ([6099a4a](6099a4a)) * floating action button component ([b784578](b784578)) * integrate job overview modal ([ccfaf09](ccfaf09)) * job overview and modal component ([0bff1d3](0bff1d3)) * move ClassKey to own component ([433308a](433308a)) * move job overview to own page; no modal ([beb504f](beb504f)) * only show full summary of most recent import once by default ([1a947f5](1a947f5)) * recreate previously run jobs from job overview page ([6b32878](6b32878)) * show form validation summary when form is submitted ([da14924](da14924)) * **export:** disable export button while content is loading ([8e63341](8e63341)) * **menu:** display icons for import / export section headers ([53ae61c](53ae61c)) * **ui:** style prefix technical terms ([2d1fbc4](2d1fbc4)) * add @dhis2/ui-forms dependency ([5ac2ea3](5ac2ea3)) * add dataElement Scheme to Event import parameters ([c92b375](c92b375)) * add fields used for data export page ([13a3d46](13a3d46)) * all previous cypress tests passing ([3fa669c](3fa669c)) * async form submission, extracted form elements ([6410e7b](6410e7b)) * context Schemes removed ([817aeec](817aeec)) * optimize api schema request ([75884cf](75884cf)) * show a `job started` alert when a job is started without error ([90d56a5](90d56a5)) * **attributes:** prepare attributes fetching & state management ([#67](#67)) ([f61ee93](f61ee93)) * **ui/strategy:** show warning box when DELETE is selected ([75eed04](75eed04)) * add firstRowIsHeader param for csv meta data import ([#43](#43)) ([7a049ea](7a049ea)) * add schemes for event import export ([1b271d0](1b271d0)) * add skip audit option to data import page ([#55](#55)) (DHIS2-7020) ([eb07f9e](eb07f9e)) * checkbox list component ([034be33](034be33)) * component ClassKey converted to a hook ([84e98b9](84e98b9)) * component ObjectSelect converted to a hook ([7cc13c2](7cc13c2)) * component ProgramStageSelect converted to a hook ([49ede5b](49ede5b)) * **Blob:** helper functions ([c56d7f5](c56d7f5)) * **DataExport:** Include children in data export ([#15](#15)) ([b5b8542](b5b8542)) * **DataImport:** show import conflicts in task summary ([95e03d3](95e03d3)) * **metadata dependency:** add support for optionSet ([#31](#31)) ([c80b1c3](c80b1c3)) * add support for required fields and validation ([1976778](1976778)) * **DataExport:** compressed + uncompressed ([1d208b3](1d208b3)) * **GMLImport:** detect typeReport errors ([6d7cb99](6d7cb99)) * **TaskSummary:** detect importSummaries in xhr response and show ([6bbd9e7](6bbd9e7)) * EventImport form ([bac4f4e](bac4f4e)) * Metadata Dependency ˆExport form ([deab466](deab466)) * support zipped imports ([fae56b6](fae56b6)) * **API:** get user details ([f053cd1](f053cd1)) * **DataExport:** export uncompressed data ([4e94623](4e94623)) * **Import Error:** show error on invalid file import ([8284226](8284226)) * **Org. Unit:** single select ([eebffad](eebffad)) * **testing:** Loading ([e868e65](e868e65)) * Data ˆExport form ([a60cf55](a60cf55)) * data export page ([3b48fed](3b48fed)) * data import page ([d558e3d](d558e3d)) * data set picker component ([2250335](2250335)) * Date field ([51fa907](51fa907)) * date picker component ([5e0be2c](5e0be2c)) * Event Export formˆ ([b3610e3](b3610e3)) * event export page ([40daed8](40daed8)) * event import page ([ce821ea](ce821ea)) * extract job recreation state logic to separate functions ([11d698d](11d698d)) * follow react code style + propTypes + dataTest ([87f276b](87f276b)) * form alert component ([c88f86a](c88f86a)) * form field with label helper component ([200e9d4](200e9d4)) * gml import page ([080255b](080255b)) * install cli-utils-cypress ([5b76611](5b76611)) * integrate date/time locale ([28a6e93](28a6e93)) * metadata dependency export page ([d226c69](d226c69)) * Metadata Export form ([e012bec](e012bec)) * metadata export page ([0dceea0](0dceea0)) * metadata import page ([08a9af6](08a9af6)) * navigation and routing basic skeleton ([afb70df](afb70df)) * organsition unit component ([d6e3275](d6e3275)) * page can show JobSummary before rest of body ([da6f5f7](da6f5f7)) * plus, minus icons ([94bc57b](94bc57b)) * program picker component ([ab37238](ab37238)) * remove Icon component ([ec6bc05](ec6bc05)) * responsive grid and icons ([e6d013f](e6d013f)) * save Radio btn. updates to Form state ([b69b2f1](b69b2f1)) * Schema component ([a8aabd2](a8aabd2)) * show validation messages ([5fe6dc8](5fe6dc8)) * string trimming function ([efe7c2d](efe7c2d)) * summary statistics extraction function ([66b0f38](66b0f38)) * support for import task state and fetching ([7cfe0d1](7cfe0d1)) * switch with label component ([ba8889f](ba8889f)) * tasks HOC converted to a hook ([9e1addb](9e1addb)) * tasks icon ([739a5e4](739a5e4)) * test click events ([3fa2170](3fa2170)) * tests for DataSetPicker ([31172bf](31172bf)) * tests for ElementSchemas ([078f7e3](078f7e3)) * tests for FormAlerts ([075451e](075451e)) * tests for JobOverview component ([8d70a08](8d70a08)) * tests for JobSummary ([a098746](a098746)) * tests for MenuLabel ([a1fe8ae](a1fe8ae)) * tests for MoreOptions ([63839f2](63839f2)) * tests for OrgUnitTree ([5193c7e](5193c7e)) * tests for Page ([a370d66](a370d66)) * tests for ProgramPicker ([025b845](025b845)) * tests for RadioGroup ([eba6ff9](eba6ff9)) * tests for Select ([a60ea1a](a60ea1a)) * tests for SelectableList ([eff2873](eff2873)) * tests for Switch ([a9d33d3](a9d33d3)) * tests for WithAuthority ([e82fb0f](e82fb0f)) * togglable options component ([1424ad4](1424ad4)) * toString() instead of string literals ([40f25ba](40f25ba)) * tracked entity instances export page ([6964acd](6964acd)) * tracked entity instances import page ([072f291](072f291)) * upload icon ([90e46d0](90e46d0)) * use [@dhis2](https://github.com/dhis2) scoped dependencies ([4bcab8e](4bcab8e)) * use Page components ability to show newest job ([64bc8b2](64bc8b2)) * use ui-forms RFF in export/data page ([27c5deb](27c5deb)) * use ui-forms RFF in export/event page ([1b35646](1b35646)) * use ui-forms RFF in export/metadata page ([aa678ce](aa678ce)) * use ui-forms RFF in export/metadata-dependency page ([5396f76](5396f76)) * use ui-forms RFF in import/data page ([370c783](370c783)) * use ui-forms RFF in import/event page ([70fc33e](70fc33e)) * use ui-forms RFF in import/gml page ([a0c3b9f](a0c3b9f)) * use ui-forms RFF in import/metadata page ([a08c1d4](a08c1d4)) * user HOC converted to a hook ([5a18c16](5a18c16)) * WithAuthority component ([bea2758](bea2758)) * **gh-pages:** add hosting onto github pages ([76a4559](76a4559)) * **id scheme inputs:** use select instead of radio buttons (DHIS2-7495) ([#71](#71)) ([3711fef](3711fef)) * **input components:** add missing components for Event export page ([c0cd92f](c0cd92f)) * **integrate react-router:** use hash routing ([9b1355b](9b1355b)) * **Loading:** show loading while authenticating ([a111491](a111491)) * **material-ui:** use theme at root level ([58ff5a3](58ff5a3)) * **object:** add api helpers ([be4fe6d](be4fe6d)) * **object:** add ObjectList and ObjectType components ([39c0ec5](39c0ec5)) * **object:** add redux components ([a0cc1bc](a0cc1bc)) * **postcss:** automated RTL language support ([faae688](faae688)) * **program:** add redux components ([c55c64c](c55c64c)) * **program & stages:** add translations ([6c9a8c6](6c9a8c6)) * **program stages:** add redux components ([3459942](3459942))
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This PR will change the way what Content-Type header is being sent with the request.
This will allow to send .zip files without having to have .json.zip as file extension.
Fixes DHIS2-6247 (https://jira.dhis2.org/browse/DHIS2-6247)