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

SparkleUpdateInfoProvider produces can't concat str to bytes error when building URL #906

Open
homebysix opened this issue Oct 15, 2023 · 0 comments

Comments

@homebysix
Copy link
Member

homebysix commented Oct 15, 2023

Description

When processing certain Sparkle feeds with no url specified in the enclosure, the error can't concat str to bytes can be produced. One Sparkle feed that produces this behavior is https://redsweater.com/touche/appcast.php, which does not include a url for v1.1.5.

<item>
  <title>Touch&#xE9; 1.1.5</title>
  <description><![CDATA[ <strong>Touché 1.1.5</strong> <ul> <li>Restore functionality of the app on recent versions of macOS</li> </ul> <p><strong>Note</strong>: unfortunately, updating from Touché 1.1.4 doesn't won't work as expected for this update. Please download Touché 1.1.5 directly and replace the copy of Touché on your Mac. ]]></description>
  <pubDate>Tue, 17 Aug 2021 21:08:58 GMT</pubDate>
  <enclosure sparkle:version="149" sparkle:shortVersionString="1.1.5"/>
  <sparkle:informationalUpdate>true</sparkle:informationalUpdate>
  <sparkle:minimumSystemVersion>10.12</sparkle:minimumSystemVersion>
  <link>https://redsweater.com/touche/</link>
</item>

Steps to reproduce

I've created a download recipe for the Touché app that demonstrates this issue. The recipe is contained below.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Comment</key>
	<string>Created with Recipe Robot v2.3.0 (https://github.com/homebysix/recipe-robot)</string>
	<key>Description</key>
	<string>Downloads the latest version of Touché.</string>
	<key>Identifier</key>
	<string>com.github.homebysix.download.Touché</string>
	<key>Input</key>
	<dict>
		<key>NAME</key>
		<string>Touché</string>
	</dict>
	<key>MinimumVersion</key>
	<string>2.3</string>
	<key>Process</key>
	<array>
		<dict>
			<key>Arguments</key>
			<dict>
				<key>appcast_url</key>
				<string>https://redsweater.com/touche/appcast.php</string>
			</dict>
			<key>Processor</key>
			<string>SparkleUpdateInfoProvider</string>
		</dict>
		<dict>
			<key>Arguments</key>
			<dict>
				<key>filename</key>
				<string>%NAME%-%version%.zip</string>
			</dict>
			<key>Processor</key>
			<string>URLDownloader</string>
		</dict>
		<dict>
			<key>Processor</key>
			<string>EndOfCheckPhase</string>
		</dict>
		<dict>
			<key>Arguments</key>
			<dict>
				<key>archive_path</key>
				<string>%pathname%</string>
				<key>destination_path</key>
				<string>%RECIPE_CACHE_DIR%/%NAME%</string>
				<key>purge_destination</key>
				<true/>
			</dict>
			<key>Processor</key>
			<string>Unarchiver</string>
		</dict>
		<dict>
			<key>Arguments</key>
			<dict>
				<key>input_path</key>
				<string>%RECIPE_CACHE_DIR%/%NAME%/Touché.app</string>
				<key>requirement</key>
				<string>identifier "com.red-sweater.touche" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "493CVA9A35"</string>
			</dict>
			<key>Processor</key>
			<string>CodeSignatureVerifier</string>
		</dict>
	</array>
</dict>
</plist>

When running the above recipe, AutoPkg 3.0rc2 produces this error:

% ./Code/autopkg run -vv "~/Library/AutoPkg/RecipeRobotTestOutput/Red Sweater Software/Touché.download.recipe"
**load_recipe time: 0.00034324999433010817
Processing ~/Library/AutoPkg/RecipeRobotTestOutput/Red Sweater Software/Touché.download.recipe...
WARNING: ~/Library/AutoPkg/RecipeRobotTestOutput/Red Sweater Software/Touché.download.recipe is missing trust info and FAIL_RECIPES_WITHOUT_TRUST_INFO is not set. Proceeding...
SparkleUpdateInfoProvider
{'Input': {'appcast_url': 'https://redsweater.com/touche/appcast.php'}}
can't concat str to bytes
Failed.
Receipt written to ~/Library/AutoPkg/Cache/com.github.homebysix.download.Touché/receipts/Touché.download-receipt-20231015-144235.plist

The following recipes failed:
    ~/Library/AutoPkg/RecipeRobotTestOutput/Red Sweater Software/Touché.download.recipe
        Error in com.github.homebysix.download.Touché: Processor: SparkleUpdateInfoProvider: Error: can't concat str to bytes

Nothing downloaded, packaged or imported.

Expected behavior

Items with no URL should be ignored during Sparkle feed parsing, since they're not useful for the purposes of automating software download.

Proposal

One solution for this is to skip enclosures without URLs specified, which I've submitted here: #907

Environment

  • OS version: 14.0
  • AutoPkg Version: 3.0rc2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant