Skip to content

Commit

Permalink
Merge pull request #1570 from Homebrew/strip-unprintable
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid authored Jan 22, 2025
2 parents 6a3820a + dc9e0fa commit f5acb38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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
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 f5acb38

Please sign in to comment.