zendesk / zcli

A command-line tool for Zendesk
https://developer.zendesk.com
Apache License 2.0
56 stars 18 forks source link

fix: convert Windows paths to POSIX format #219

Closed sebastienwarin closed 5 months ago

sebastienwarin commented 5 months ago

Description

Fixes an issue on Windows where the template identifier incorrectly matches due to non-posix path separator being used, but posix path separators being expected.

Do NOT write here! This section will be filled in by GitHub Action automatically. If you don't want this, either remove the markers or write outside the fences.

Detail

On Windows, the globSync function returns the \ path separator by default. However, we are matching against a posix path separator of / as can be seen on line 9's split pattern of template.split('templates/'). This is causing the following error:

TypeError: Cannot read properties of undefined (reading 'split')

This PR converts Window paths to POSIX paths (by replacing \ to /) for the inputs and the outputs of the globSync function without used the new posix option available from glob 10.1.0.

Checklist

luis-almeida commented 5 months ago

Thanks @sebastienwarin for your help fixing this issue! Closing in favour of https://github.com/zendesk/zcli/pull/220 which includes the commit in this PR and just got released.