mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-22 02:50:32 +03:00
Fixed implementation of adding shortcut names with the / symbol
This commit is contained in:
parent
a18e1a6cce
commit
5bc8309abd
@ -124,11 +124,11 @@ class shortcut:
|
||||
:param name: Name of the application
|
||||
:param type: Link type - FILESYSTEM or URL
|
||||
'''
|
||||
self.dest = dest
|
||||
self.dest = self.replace_slashes(dest)
|
||||
self.path = path
|
||||
self.expanded_path = None
|
||||
self.arguments = arguments
|
||||
self.name = name
|
||||
self.name = self.replace_name(name)
|
||||
self.action = action
|
||||
self.changed = ''
|
||||
self.icon = None
|
||||
@ -136,6 +136,22 @@ class shortcut:
|
||||
self.is_in_user_context = self.set_usercontext()
|
||||
self.type = ttype
|
||||
|
||||
def replace_slashes(self, input_path):
|
||||
if input_path.startswith('%'):
|
||||
index = input_path.find('%', 1)
|
||||
if index != -1:
|
||||
replace_path = input_path[:index + 2] + input_path[index + 2:].replace('/','-')
|
||||
return replace_path
|
||||
return input_path.replace('/','-')
|
||||
|
||||
def replace_name(self, input_name):
|
||||
if input_name.startswith('%'):
|
||||
index = input_name.find('%', 1)
|
||||
if index != -1:
|
||||
replace_name = input_name[index + 2:]
|
||||
return replace_name
|
||||
return input_name
|
||||
|
||||
def __str__(self):
|
||||
result = self.to_json()
|
||||
return result
|
||||
|
@ -175,7 +175,9 @@ def expand_windows_var(text, username=None):
|
||||
|
||||
result = text
|
||||
for var in variables.keys():
|
||||
result = result.replace('%{}%'.format(var), variables[var])
|
||||
result = result.replace('%{}%'.format(var),
|
||||
variables[var] if variables[var][-1] == '/'
|
||||
else variables[var] +'/')
|
||||
|
||||
return result
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user