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

ApiManagement problems with uploading .yml or json files including the word yaml #430

Open
DavidJSykes opened this issue Jul 30, 2020 · 0 comments

Comments

@DavidJSykes
Copy link

if (file.name.includes('yaml')) {
swaggerObject = YAML.parse(e.target.result)
swagger = JSON.stringify(swaggerObject)
} else {
swaggerObject = JSON.parse(e.target.result)
swagger = JSON.stringify(swaggerObject)
}

Uploading a file ending in .yml does not work; it results in a JSONdecode error when it hits the else block.

The existing code needs to be updated to check for yml, and I would write it to use endsWith instead of includes to avoid having files named yaml.json being an issue.

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