Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kleopatra
Commits
2f357f08
Commit
2f357f08
authored
Jul 20, 2022
by
Ingo Klöcker
Browse files
Avoid duplicating the last empty line when writing back lines
GnuPG-bug-id: 6096
parent
58c7ecce
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/commands/changeroottrustcommand.cpp
View file @
2f357f08
...
...
@@ -252,6 +252,10 @@ QString change_trust_file(const QString &trustListFile, const QString &key, Key:
if
(
QFile
::
exists
(
trustListFile
))
{
// non-existence is not fatal...
if
(
QFile
in
(
trustListFile
);
in
.
open
(
QIODevice
::
ReadOnly
))
{
trustListFileContents
=
in
.
readAll
().
split
(
'\n'
);
// remove last empty line to avoid adding more empty lines when we write the lines
if
(
!
trustListFileContents
.
empty
()
&&
trustListFileContents
.
back
().
isEmpty
())
{
trustListFileContents
.
pop_back
();
}
}
else
{
// ...but failure to open an existing file _is_
return
i18n
(
"Cannot open existing file
\"
%1
\"
for reading: %2"
,
trustListFile
,
in
.
errorString
());
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment