Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mas: strip unprintable characters from app names #1570

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/bundle/mac_app_store_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ 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
# Strip unprintable characters
[app_details[:id], app_details[:name].gsub(/[[:cntrl:]]|[\p{C}]/, "")] if app_details
MikeMcQuaid marked this conversation as resolved.
Show resolved Hide resolved
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)
MikeMcQuaid marked this conversation as resolved.
Show resolved Hide resolved
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
Loading