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

[email protected]: absolutifyPointer returns [ERR_INVALID_URL]: Invalid URL on Windows #3149

Closed
AlvaroRausell opened this issue Sep 18, 2023 · 5 comments

Comments

@AlvaroRausell
Copy link

Q&A (please complete the following information)

  • OS: Windows
  • Environment: Node.js 18
  • Method of installation: npm
  • Swagger-Client version: 3.22.2

Describe the bug you're encountering

The PR #3148 introduces a bug on Windows, as the returned value for cwd has backslashes and line 82 fails with [ERR_INVALID_URL]: Invalid URL.

To reproduce...

Run absolutifyPointer on Windows, which any parameters.

Expected behavior

It should return the same path it would on UNIX systems, not give a TypeError.

Stack trace

TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:405:5)
    at new URL (node:internal/url:611:13)
    at Object.resolve (C:\S000\WMB\inst.images\amd64_nt_4\shipdata\server\nodejs_all\node_modules\@swagger-api\apidom-reference\cjs\util\url.cjs:230:23)
    at absolutifyPointer (C:\S000\WMB\inst.images\amd64_nt_4\shipdata\server\nodejs_all\node_modules\swagger-client\lib\specmap\helpers.js:65:40)
    at Object.plugin (C:\S000\WMB\inst.images\amd64_nt_4\shipdata\server\nodejs_all\node_modules\swagger-client\lib\specmap\lib\refs.js:159:60)
    at traverse (C:\S000\WMB\inst.images\amd64_nt_4\shipdata\server\nodejs_all\node_modules\swagger-client\lib\specmap\index.js:143:35)
    at traverse.next (<anonymous>)
    at traverse (C:\S000\WMB\inst.images\amd64_nt_4\shipdata\server\nodejs_all\node_modules\swagger-client\lib\specmap\index.js:137:26)
    at traverse.next (<anonymous>)
    at traverse (C:\S000\WMB\inst.images\amd64_nt_4\shipdata\server\nodejs_all\node_modules\swagger-client\lib\specmap\index.js:137:26)
    at traverse.next (<anonymous>)
    at traverse (C:\S000\WMB\inst.images\amd64_nt_4\shipdata\server\nodejs_all\node_modules\swagger-client\lib\specmap\index.js:137:26)
    at traverse.next (<anonymous>)
    at traverse (C:\S000\WMB\inst.images\amd64_nt_4\shipdata\server\nodejs_all\node_modules\swagger-client\lib\specmap\index.js:137:26)
    at traverse.next (<anonymous>)
    at traverse (C:\S000\WMB\inst.images\amd64_nt_4\shipdata\server\nodejs_all\node_modules\swagger-client\lib\specmap\index.js:137:26) {
  input: '',
  code: 'ERR_INVALID_URL'
}```

@char0n
Copy link
Member

char0n commented Sep 18, 2023

Hi @AlvaroRausell,

Thanks for reporting, it seems that this is never ending story. I'll try to address this during tomorrow morning.

@char0n
Copy link
Member

char0n commented Sep 18, 2023

Addressed in #3150.

Given that SwaggerClient can only process HTTP(S) URLs, we can use static CWD in form of a constant URL.

char0n added a commit that referenced this issue Sep 18, 2023
swagger-bot pushed a commit that referenced this issue Sep 18, 2023
## [3.22.3](v3.22.2...v3.22.3) (2023-09-18)

### Bug Fixes

* **specmap:** provide multi platform backward compatible relative URL Reference resolution ([#3150](#3150)) ([7a5bc77](7a5bc77)), closes [#3149](#3149)
@char0n
Copy link
Member

char0n commented Sep 18, 2023

Released in https://github.com/swagger-api/swagger-js/releases/tag/v3.22.3. @AlvaroRausell can you please confirm you're fine? THanks!

@char0n char0n closed this as completed Sep 18, 2023
@AlvaroRausell
Copy link
Author

Hi @char0n, all fixed now! Thanks for the quick response

@char0n
Copy link
Member

char0n commented Sep 19, 2023

Huh, glad to hear that ;]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants