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
717f0d2c
Commit
717f0d2c
authored
6 years ago
by
Keith Butler
Browse files
Options
Downloads
Patches
Plain Diff
Re #23248 removing un-needed sanitise checks from ProjectRecovery
parent
d0264f35
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Framework/API/src/ScriptBuilder.cpp
+0
-5
0 additions, 5 deletions
Framework/API/src/ScriptBuilder.cpp
MantidPlot/src/ProjectRecovery.cpp
+6
-33
6 additions, 33 deletions
MantidPlot/src/ProjectRecovery.cpp
MantidPlot/src/ProjectRecovery.h
+0
-3
0 additions, 3 deletions
MantidPlot/src/ProjectRecovery.h
with
6 additions
and
41 deletions
Framework/API/src/ScriptBuilder.cpp
+
0
−
5
View file @
717f0d2c
...
...
@@ -13,9 +13,7 @@
#include
"MantidKernel/PropertyHistory.h"
#include
<boost/algorithm/string/classification.hpp>
#include
<boost/optional.hpp>
#include
<boost/range/algorithm/remove_if.hpp>
#include
<boost/range/algorithm_ext/erase.hpp>
#include
<boost/utility.hpp>
#include
<set>
...
...
@@ -267,9 +265,6 @@ const std::string ScriptBuilder::buildPropertyString(
prop
=
propHistory
.
name
()
+
opener
+
propHistory
.
value
()
+
"'"
;
}
// Sanitise for a comment #
std
::
string
blacklistChars
{
"#"
};
boost
::
remove_erase_if
(
prop
,
boost
::
is_any_of
(
blacklistChars
));
}
return
prop
;
...
...
This diff is collapsed.
Click to expand it.
MantidPlot/src/ProjectRecovery.cpp
+
6
−
33
View file @
717f0d2c
...
...
@@ -126,7 +126,7 @@ getRecoveryFolderCheckpoints(const std::string &recoveryFolderPath) {
std
::
string
removeInvalidFilenameChars
(
std
::
string
s
)
{
// NTFS is most restrictive, so blacklist on this
std
::
string
blacklistChars
{
"
#
:*?<>|/
\"\\
"
};
std
::
string
blacklistChars
{
":*?<>|/
\"\\
"
};
boost
::
remove_erase_if
(
s
,
boost
::
is_any_of
(
blacklistChars
));
return
s
;
}
...
...
@@ -356,17 +356,12 @@ void ProjectRecovery::loadRecoveryCheckpoint(const Poco::Path &recoveryFolder) {
auto
projectFile
=
Poco
::
Path
(
recoveryFolder
).
append
(
OUTPUT_PROJ_NAME
);
bool
loadCompleted
=
false
;
if
(
!
isSanitised
(
recoveryFolder
))
{
if
(
!
QMetaObject
::
invokeMethod
(
m_windowPtr
,
"loadProjectRecovery"
,
Qt
::
BlockingQueuedConnection
,
Q_RETURN_ARG
(
bool
,
loadCompleted
),
Q_ARG
(
const
std
::
string
,
projectFile
.
toString
())))
{
throw
std
::
runtime_error
(
"Project Recovery: Failed to load project "
"windows - Qt binding failed"
);
}
}
else
{
g_log
.
debug
(
"Recovered workspace name was sanitised"
);
loadCompleted
=
true
;
m_windowPtr
,
"loadProjectRecovery"
,
Qt
::
BlockingQueuedConnection
,
Q_RETURN_ARG
(
bool
,
loadCompleted
),
Q_ARG
(
const
std
::
string
,
projectFile
.
toString
())))
{
throw
std
::
runtime_error
(
"Project Recovery: Failed to load project windows - Qt binding failed"
);
}
if
(
!
loadCompleted
)
{
...
...
@@ -529,26 +524,4 @@ void ProjectRecovery::saveWsHistories(const Poco::Path &historyDestFolder) {
}
}
/**
* Check the OUTPUT_PROJ_NAME file for WorkspaceNames and if any of them have
* "#" then return True else False.
*
*/
bool
ProjectRecovery
::
isSanitised
(
const
Poco
::
Path
&
recoveryFolder
)
{
auto
projectFile
=
Poco
::
Path
(
recoveryFolder
).
append
(
OUTPUT_PROJ_NAME
);
std
::
ifstream
propFile
(
projectFile
.
toString
(),
std
::
ios_base
::
in
);
std
::
string
processString
((
std
::
istreambuf_iterator
<
char
>
(
propFile
)),
std
::
istreambuf_iterator
<
char
>
());
propFile
.
close
();
auto
filePosition
=
processString
.
find
(
"WorkspaceNames"
)
+
15
;
auto
endOfPosition
=
processString
.
find
(
"</mantidworkspaces>"
);
for
(;
filePosition
<
endOfPosition
;
++
filePosition
)
{
if
(
processString
[
filePosition
]
==
char
(
'#'
))
{
return
true
;
}
}
return
false
;
}
}
// namespace MantidQt
This diff is collapsed.
Click to expand it.
MantidPlot/src/ProjectRecovery.h
+
0
−
3
View file @
717f0d2c
...
...
@@ -100,9 +100,6 @@ private:
/// Saves the current workspace's histories from Mantid
void
saveWsHistories
(
const
Poco
::
Path
&
projectDestFile
);
/// Checks if the workspaces had been sanitised when saved
bool
isSanitised
(
const
Poco
::
Path
&
recoveryFolder
);
/// Background thread which runs the saving body
std
::
thread
m_backgroundSavingThread
;
...
...
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