Skip to content

Commit

Permalink
Fix RTF license when input data is a file path
Browse files Browse the repository at this point in the history
  • Loading branch information
detche authored Dec 11, 2019
1 parent d864e72 commit b3bed79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dmgbuild/licensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ def add_license(filename, license_info):
is_two_byte = lang_id in (14, 51, 52, 53) # Japanese, Korean, SimpChinese, TradChinese

if os.path.isfile(license_data):
with open(license_data) as f:
mode = 'rb' if license_data.endswith('.rtf') else 'r'
with open(license_data, mode=mode) as f:
license_data = f.read()

if type(license_data) == bytes and license_data.startswith(b'{\\rtf1'):
Expand Down

0 comments on commit b3bed79

Please sign in to comment.