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

Errant plist data in metadata for MSCompanyPortal download recipe causes autopg run to abort #464

Open
carlashley opened this issue Aug 1, 2023 · 0 comments

Comments

@carlashley
Copy link
Contributor

Describe the problem
When testing the MSCompanyPortal download recipe relating to #463 there was an issue caused by an errant line break in the Location value that the Microsoft feed had.

Preferences contents
N/A

AutoPkg output

{'Output': {'additional_pkginfo': {'installs': [{'CFBundleVersion': '53.2307220.002',
                                                 'path': '/Applications/Company '
                                                         'Portal.app',
                                                 'type': 'application'}],
                                   'minimum_os_version': '10.15'},
            'minimum_os_version': '10.15',
            'url': '\n'
                   '                '
                   'https://officecdnmac.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate/CompanyPortal_5.2307.1-Upgrade.pkg',
            'version': '53.2307220.002'}}
URLDownloader
{'Input': {'filename': 'CompanyPortal-53.2307220.002.pkg',
           'url': '\n'
                  '                '
                  'https://officecdnmac.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate/CompanyPortal_5.2307.1-Upgrade.pkg'}}
URLDownloader: No value supplied for prefetch_filename, setting default value of: False
URLDownloader: No value supplied for CHECK_FILESIZE_ONLY, setting default value of: False
URLDownloader: ERROR: (3) URL rejected: Malformed input to a URL function
<snip>
subprocess.CalledProcessError: Command '['/usr/bin/curl', '--silent', '--show-error', '--no-buffer', '--dump-header', '-', '--speed-time', '30', '--location', '--url', '\n                https://officecdnmac.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate/CompanyPortal_5.2307.1-Upgrade.pkg', '--fail', '--output', '/Users/jappleseed/Library/AutoPkg/Cache/com.github.autopkg.download.MSCompanyPortal/downloads/tmpbs2pfwb7']' returned non-zero exit status 3.```

**Expected behavior**
While I don't really expect that this processor should have to deal with these errant issues, adding in a test relating to the `metadata` that is created [here](https://github.com/autopkg/recipes/blob/aae83c7fb5bb1f8b1c2bff14ec81ec577802712f/MSOfficeUpdates/MSOfficeMacURLandUpdateInfoProvider.py#L284) sorts this out.

    # Ensure the 'location' key containing a URL is stripped to avoid processor failure
    if isinstance(metadata, list) and all(isinstance(item, dict) for item in metadata):
        metadata = [
            {k: v.strip() if isinstance(v, str) and v is not None else v for k, v in item.items()}
            for item in metadata.copy()
        ]

Perhaps this could be a part of the processor script to potentially avoid this type of abort in the future?

**Version (please complete the following information):**
- OS version: macOS 13.5
- AutoPkg Version: 2.7.2
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