Skip to content
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

Check filename for invalid characters before saving e.g. "a:b.obj" #239

Merged
merged 2 commits into from
Oct 16, 2019

Conversation

maleike
Copy link
Contributor

@maleike maleike commented Aug 28, 2019

Per default the Data Manager's "Save..." option via QmitkIOUtil proposes the DataNode's name as the filename. When the node name is "a:b" or simliar, this might produce files that are empty and named slightly different (in the example "a" instead of "a:b.obj"). The problem is that file systems do not accept all characters (esp. Windows)

Without a in QmitkIOUtil writers might (and some do) create empty files
that are not even named as expected (e.g. "a" instead of "a:b.obj").

The opening of a std::ofstream for such a filename does not seem to set
any fail-bits (all checked for in the affected writer class). So even writers that correctly check for the output stream state won't notice the problem.

The alternative to a check here would be a check in each possible writer class. This seems worse.

Signed-off-by: Daniel Maleike daniel.maleike@stryker.com

Without such a check writers might (and some do) create empty files
that are not even named as expected (e.g. "a" instead of "a:b.obj").

The opening std::ofstream for such a filename does not seem to set
any fail-bits (all checked for in the affected writer class).

The alternative to a check here would be a check in each possible writer
class. This seems worse.

Signed-off-by: Daniel Maleike <daniel.maleike@stryker.com>
@maleike maleike changed the title Check filename before saving e.g. "a:b.obj" Check filename for invalid characters before saving e.g. "a:b.obj" Aug 28, 2019
Modules/QtWidgets/src/QmitkIOUtil.cpp Outdated Show resolved Hide resolved
Modules/QtWidgets/src/QmitkIOUtil.cpp Outdated Show resolved Hide resolved
Modules/QtWidgets/src/QmitkIOUtil.cpp Outdated Show resolved Hide resolved
Modules/QtWidgets/src/QmitkIOUtil.cpp Outdated Show resolved Hide resolved
Signed-off-by: Daniel Maleike <daniel.maleike@stryker.com>
@mitk-bot mitk-bot merged commit f435c53 into MITK:master Oct 16, 2019
@maleike
Copy link
Contributor Author

maleike commented Oct 16, 2019

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants