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

fix guessVocabularyFromURI when some vocabulary has no URI space #1559

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

osma
Copy link
Member

@osma osma commented Nov 23, 2023

Reasons for creating this PR

I ran into a bug when displaying external mappings (to LCSH and Wikidata) on a YSO concept page. I've configured one unrelated vocabulary (YSO-time) without setting a URI space. That breaks the mappings display:

image

It turns out that if there is a vocabulary without a defined URI space, then external mappings of other vocabularies do not resolve properly because the Model.guessVocabularyFromURI method breaks. This PR fixes the problem by using an additional if check for empty URI space.

Link to relevant issue(s), if any

Description of the changes in this PR

When constructing a cache of URI space to vocabulary mappings, don't include vocabularies that don't have a URI space.

Known problems or uncertainties in this PR

Ideally there should be a unit test, but we don't have any existing tests for empty URI space either.

The same fix should be applied to Skosmos 3 as well. I will do that in a separate PR.

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

@osma osma added the bug label Nov 23, 2023
@osma osma added this to the 2.17 milestone Nov 23, 2023
@osma osma self-assigned this Nov 23, 2023
Copy link

sonarcloud bot commented Nov 23, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link

codecov bot commented Nov 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (88c2c78) 70.20% compared to head (a82e9a4) 70.22%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1559      +/-   ##
============================================
+ Coverage     70.20%   70.22%   +0.01%     
- Complexity     1664     1665       +1     
============================================
  Files            32       32              
  Lines          4293     4295       +2     
============================================
+ Hits           3014     3016       +2     
  Misses         1279     1279              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@osma osma merged commit a08b033 into master Nov 23, 2023
15 of 17 checks passed
@osma osma deleted the fix-guessvocabulary-no-urispace branch November 23, 2023 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done (verified in test.dev.finto.fi, set Milestone 3.0 for both issue & PR)
Development

Successfully merging this pull request may close these issues.

1 participant