autopkg / recipes

Recipes for AutoPkg
231 stars 204 forks source link

FR - MSOffice - MSOfficeMacURLandUpdateInfoProvider.py - BASE_URL change suggestion #463

Open carlashley opened 1 year ago

carlashley commented 1 year ago

Describe the problem When using the autopkg.recipies/MSOfficeUpdates download recipe the BASE_URL value in MSOfficeMacURLandUpdateInfoProvider.py is set to point to https://officecdn.microsoft.com/pr/%s/MacAutoupdate/%s.xml, looking at the Microsoft Auto Updater app, it uses https://officecdnmac.microsoft.com as the "base".

This FR suggests moving the BASE_URL to point to https://officecdnmac.microsoft.com/pr/%s/MacAutoupdate/%s.xml to keep inline with the Microsoft updater behaviour.

I'm happy to create a PR, but wanted to raise this for possible discussion first.

Preferences contents N/A

AutoPkg output Changing the domain in the provider script to point to officecdnmac works as expected - gist of run here

*Expected behavior N/A

Version (please complete the following information):

carlashley commented 1 year ago

Testing downloads for MSAutoUpdate, OneNote, Teams, Defender ATP, Edge, Outlook, Word, PowerPoint, Excel, and Skype For Business all worked - note, where there were recipes for 2019 products, only those download recipes were tested (aka, MSOutlook2019.download.recipe was tested, not MSOutlook2016.download.recipe).

There were a couple of failures, but they don't appear related to the URL change: MSCompanyPortal:

       Error in com.github.autopkg.download.MSCompanyPortal: Processor: URLDownloader: Error: curl: (3) URL rejected: Malformed input to a URL function

Which seems to be caused by an errant \n in the string passed to the URL:

MSOfficeMacURLandUpdateInfoProvider: Additional pkginfo: {'minimum_os_version': '10.15', 'installs': [{'CFBundleVersion': '53.2307220.002', 'path': '/Applications/Company Portal.app', 'type': 'application'}]}
{'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.

Stripping that errant \n and space/tab string out worked.

MicrosoftOfficeMacProduct also failed, but that seems to be caused by the key MicrosoftOfficeMacProduct not existing in the provider script.

gregneagle commented 4 months ago

Curious where/how you found this other URL.

gregneagle commented 4 months ago

I see

$ strings Microsoft\ Update\ Assistant.app/Contents/MacOS/Microsoft\ Update\ Assistant | grep officecdn
officecdnmac.microsoft.com
officecdnmac.microsoft.com

so perhaps that's it?

carlashley commented 3 months ago

Yes, that's where I had found the URLS.