Skip to content

Commit

Permalink
mas: strip unprintable characters from app names
Browse files Browse the repository at this point in the history
  • Loading branch information
EricFromCanada committed Jan 22, 2025
1 parent 6a3820a commit 31e2c03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundle/mac_app_store_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def apps
app_details = app.match(/\A(?<id>\d+)\s+(?<name>.*?)\s+\((?<version>[\d.]*)\)\Z/)

# Only add the application details should we have a valid match.
[app_details[:id], app_details[:name]] if app_details
[app_details[:id], app_details[:name].gsub(/[[:cntrl:]]|[\p{C}]/, "")] if app_details
end
else
[]
Expand Down
3 changes: 3 additions & 0 deletions spec/bundle/mac_app_store_dumper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
896732467 你好 (1.1)
634324555 مرحبا (1.0)
234324325 áéíóú (1.0)
310633997 non>‎<printing>⁣<characters (1.0)
HEREDOC
end

Expand All @@ -93,6 +94,7 @@
["896732467", "你好"],
["634324555", "مرحبا"],
["234324325", "áéíóú"],
["310633997", "non><printing><characters"],
]
end

Expand All @@ -108,6 +110,7 @@
mas "My App?", id: 543213432
mas "my 😊 app", id: 123345384
mas "my,comma,app", id: 893489734
mas "non><printing><characters", id: 310633997
mas "Numbers", id: 409203825
mas "Pages", id: 409201541
mas "Pastebin It!", id: 944924917
Expand Down

0 comments on commit 31e2c03

Please sign in to comment.