Skip to content

Commit

Permalink
Fix dialog matching when character_substitute is not set to underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdstaaij committed Nov 7, 2015
1 parent 190c454 commit 4dd1c58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ def get_backup_dir
def get_media_dir(dialog)
File.join(get_backup_dir, get_safe_name(dialog['print_name']) + '_files')
end

def strip_tg_special_chars(print_name)
print_name.gsub(/[_@#]/, '')
end
6 changes: 4 additions & 2 deletions telegram-history-dump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ def backup_target?(dialog)
return true if candidates.empty?
candidates.each do |candidate|
next unless candidate
dialog_name = get_safe_name(dialog['print_name']).upcase
candidate_name = get_safe_name(candidate).upcase
dialog_name = strip_tg_special_chars(dialog['print_name'])
dialog_name = get_safe_name(dialog_name).upcase
candidate_name = strip_tg_special_chars(candidate)
candidate_name = get_safe_name(candidate_name).upcase
return true if dialog_name.include?(candidate_name)
end
false
Expand Down

0 comments on commit 4dd1c58

Please sign in to comment.