Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
4a818166
Unverified
Commit
4a818166
authored
6 years ago
by
Martyn Gigg
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #22783 from mantidproject/22780_proj_recovery_sanitise_chars
Project Recovery - Sanitise filename characters
parents
c67257e9
edec2fd2
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MantidPlot/src/ProjectRecovery.cpp
+10
-1
10 additions, 1 deletion
MantidPlot/src/ProjectRecovery.cpp
with
10 additions
and
1 deletion
MantidPlot/src/ProjectRecovery.cpp
+
10
−
1
View file @
4a818166
...
...
@@ -11,7 +11,9 @@
#include
"MantidKernel/Logger.h"
#include
"MantidKernel/UsageService.h"
#include
"boost/algorithm/string/classification.hpp"
#include
"boost/optional.hpp"
#include
"boost/range/algorithm_ext/erase.hpp"
#include
"Poco/DirectoryIterator.h"
#include
"Poco/NObserver.h"
...
...
@@ -132,6 +134,13 @@ getRecoveryFolderCheckpoints(const std::string &recoveryFolderPath) {
return
folderPaths
;
}
std
::
string
removeInvalidFilenameChars
(
std
::
string
s
)
{
// NTFS is most restrictive, so blacklist on this
std
::
string
blacklistChars
{
":*?<>|/
\"\\
"
};
boost
::
remove_erase_if
(
s
,
boost
::
is_any_of
(
blacklistChars
));
return
s
;
}
const
std
::
string
OUTPUT_PROJ_NAME
=
"recovery.mantid"
;
// Config keys
...
...
@@ -437,7 +446,7 @@ void ProjectRecovery::saveWsHistories(const Poco::Path &historyDestFolder) {
alg
->
setLogging
(
false
);
for
(
const
auto
&
ws
:
wsHandles
)
{
std
::
string
filename
=
ws
->
getName
();
std
::
string
filename
=
removeInvalidFilenameChars
(
ws
->
getName
()
)
;
filename
.
append
(
".py"
);
Poco
::
Path
destFilename
=
historyDestFolder
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment