Skip to content

Conversation

@pkaminski
Copy link

I found at least one Bower package (serialized-lru-cache) that defines its license as:

  "license": {
    "type": "MIT",
    "url": "http://github.com/jmendiara/serialized-lru-cache/raw/master/LICENSE"
  },

No idea if it's spec-compliant or not, but it will crash bower-license and it's a simple fix, so...


This change is Reviewable

I found at least one Bower package (`serialized-lru-cache`) that defines its license as:
```
  "license": {
    "type": "MIT",
    "url": "http://github.com/jmendiara/serialized-lru-cache/raw/master/LICENSE"
  },
```
No idea if it's spec-compliant or not, but it will crash `bower-license` and it's a simple fix, so...
@mojoaxel
Copy link
Contributor

I think this is a "bug" in the bower-config of serialized-lru-cache. This type of license definition is not in the spec. This issue should be fixed there and not here.
Thanks anyway for finding and reporting!

@anacronw
Copy link
Member

I agree, I don't think the library should be parsing arbitrary specs, but the crashing is not good.

I think what makes sense is simply to check for type:

if (typeof bowerData.license === 'string'){
  moduleInfo.licenses = moduleInfo.licenses.concat(bowerData.license)
}

@pkaminski
Copy link
Author

OK, I opened a PR against serialized-lru-cache: jmendiara/serialized-lru-cache#1

FWIW, the spec you pointed to also allows an array of strings for the license value, so the type check should probably allow for that.

@mojoaxel
Copy link
Contributor

mojoaxel commented Oct 5, 2020

Fixed in jmendiara/serialized-lru-cache#1
@Badunk Can be closed here!

mojoaxel added a commit to mojoaxel/bower-license that referenced this pull request Oct 5, 2020
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

Successfully merging this pull request may close these issues.

3 participants