def clean_path_filename(url):
 filename = url.get_file_name()
 path = url.get_path_without_file().encode(DEFAULT_ENCODING)
 if filename:
  res = path[1:]
  res += clean_filename(filename)
 else:
  res = clean_path(url.get_path().encode(DEFAULT_ENCODING))[1:]
 return res

def clean_path_filename ( url ) : filename = url . get_file_name ( ) path = url . get_path_without_file ( ) . encode ( DEFAULT_ENCODING ) if filename : res = path [ 1 : ] res += clean_filename ( filename ) else : res = clean_path ( url . get_path ( ) . encode ( DEFAULT_ENCODING ) ) [ 1 : ] return res
clean the path+filename following these rules: * if the url has a filename .