Skip to content

Commit

Permalink
Add stripping of downloaded path from file name (fix for bsc#481011)
Browse files Browse the repository at this point in the history
It also strips name from all popups which I think is good think, as
it do not write some temporary directory and instead it write relative
path to repository like "Wrong checksum for file
images/details-x86_64.xml from repository ABC"
  • Loading branch information
jreidinger committed Nov 3, 2016
1 parent 2ef3eb3 commit ff08695
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions library/packages/src/modules/SignatureCheckDialogs.rb
Expand Up @@ -463,6 +463,7 @@ def UseUnsignedItem(item_type, item_name, dont_show_dialog_ident, repository)
"Install it anyway?"
)
else
item_name = strip_download_prefix(item_name)
# popup question, %1 stands for the filename
# %2 is a repository name
# %3 is URL of the repository
Expand Down Expand Up @@ -550,6 +551,7 @@ def UseItemWithNoChecksum(item_type, item_name, dont_show_dialog_ident)
"Install it anyway?\n"
)
else
item_name = strip_download_prefix(item_name)
# popup question, %1 stands for the filename
_(
"No checksum for file %1 was found in the repository.\n" \
Expand Down Expand Up @@ -736,6 +738,7 @@ def UseCorruptedItem(item_type, item_name, key, repository)
"Install it anyway?\n"
)
else
item_name = strip_download_prefix(item_name)
# popup question, %1 stands for the filename, %2 for the complete description of the GnuPG key (multiline)
_(
"File %1 from repository %2\n" \
Expand Down Expand Up @@ -802,6 +805,7 @@ def ItemSignedWithUnknownSignature(item_type, item_name, key_id, dont_show_dialo
"Install it anyway?"
)
else
item_name = strip_download_prefix(item_name)
# popup question, %1 stands for the filename, %2 for the complex multiline description of the GnuPG key
_(
"The file %1\n" \
Expand Down Expand Up @@ -896,6 +900,7 @@ def ItemSignedWithPublicSignature(item_type, item_name, key)
"to skip the package.\n"
)
else
item_name = strip_download_prefix(item_name)
# popup question, %1 stands for the filename, %2 for the key ID, %3 for the key name
_(
"The file %1 is digitally signed\n" \
Expand Down Expand Up @@ -1119,6 +1124,7 @@ def RunSimpleErrorPopup(heading, description_text, dont_show_dialog_ident, dont_
# @param [String] dont_show_dialog_ident Uniq ID for "don't show again"
# @return [Boolean] true when user accepts the file
def UseFileWithWrongDigest(filename, requested_digest, found_digest, dont_show_dialog_ident)
filename = strip_download_prefix(filename)
description_text =
# popup question, %1 stands for the filename, %2 is expected checksum
# %3 is the current checksum (e.g. "803a8ff00d00c9075a1bd223a480bcf92d2481c1")
Expand Down Expand Up @@ -1156,6 +1162,7 @@ def UseFileWithWrongDigest(filename, requested_digest, found_digest, dont_show_d
# @param [String] dont_show_dialog_ident Uniq ID for "don't show again"
# @return [Boolean] true when user accepts the file
def UseFileWithUnknownDigest(filename, digest, dont_show_dialog_ident)
filename = strip_download_prefix(filename)
description_text =
# popup question, %1 stands for the filename, %2 is expected digest, %3 is the current digest
Builtins.sformat(
Expand Down Expand Up @@ -1197,6 +1204,14 @@ def UseFileWithUnknownDigest(filename, digest, dont_show_dialog_ident)
publish function: :ImportGPGKeyIntoTrustedDialog, type: "boolean (map <string, any>, integer)"
publish function: :UseFileWithWrongDigest, type: "boolean (string, string, string, string)"
publish function: :UseFileWithUnknownDigest, type: "boolean (string, string, string)"

private

# helper to strip download path. It uses internal knowledge that download
# prefix ends in TmpDir.* zypp location
def strip_download_prefix(path)
path.sub(/^\/.*\/TmpDir\.[^\/]+\//, "")
end
end

SignatureCheckDialogs = SignatureCheckDialogsClass.new
Expand Down

0 comments on commit ff08695

Please sign in to comment.