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

Data integrity: Internet Archive ID is 't' generating bad thumbnails in carousels #3393

Open
jdlrobson opened this issue Apr 22, 2020 · 0 comments
Labels
Affects: UI Issues with the web site's user interface. [managed] Lead: @mekarpeles Issues overseen by Mek (Staff: Program Lead) [managed] Priority: 3 Issues that we can consider at our leisure. [managed] Type: Bug Something isn't working. [managed]

Comments

@jdlrobson
Copy link
Collaborator

jdlrobson commented Apr 22, 2020

This relates to the slack conversation between @mekarpeles and Brittany. For those who missed it, apparently this fix is not applying to:
https://openlibrary.org/subjects/in_library#ebooks=true&sort=edition_count
when you click right arrow.

The carousel item is rendered on the server side so this is likely an issue in the template.

The template uses the following code
If an Internet Archive ID is available that's used here.

$elif book.get('ia'):
    $ cover_url = '%s/b/ia/%s-M.jpg?default=%s'%(cover_host, book.get('ia')[0], fallback_cover)

For some reason some books have an inaccurate ia field. When that happens a bad URI is created like //covers.openlibrary.org/b/ia/t-M.jpg?default=https://openlibrary.org/images/icons/avatar_book.png

The template is dumb and will assume if it finds an image a cover exists. ie. It;s the default parameter in the covers api that is causing an issue.

The covers api takes a default parameter.

Two solutions to this

  1. Either we cannot depend on the IA field and we should not ever use it for the thumbnail
  2. API should be updated to 404 when an image is not available so alt text can be used.
<div class="book carousel__item">
  <div class="book-cover">
    <a href="/works/OL55532W">
      <img class="bookcover" loading="lazy"
        width="130" height="200"
        title="The three sisters by Anton Pavlovich Chekhov"
        data-lazy="//covers.openlibrary.org/b/ia/t-M.jpg?default=https://openlibrary.org/images/icons/avatar_book.png"/>
    </a>
  </div>
  <div class="book-cta"><a class="cta-btn cta-btn--available borrow-link" href="/borrow/ia/threesistersdram00chek?ref=ol" data-ol-link-track="subjects" title="Borrow The three sisters"
    data-key="subjects" data-ocaid="threesistersdram00chek">Borrow</a></div>
</div>

Evidence / Screenshot (if possible)

Screen Shot 2020-04-21 at 9 56 54 PM

Related

Very similar to #2836 possibly can be fixed at the same time.

Stakeholders

@jdlrobson jdlrobson added Type: Bug Something isn't working. [managed] Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed] labels Apr 22, 2020
@cdrini cdrini added Lead: @mekarpeles Issues overseen by Mek (Staff: Program Lead) [managed] Priority: 3 Issues that we can consider at our leisure. [managed] Affects: UI Issues with the web site's user interface. [managed] and removed Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed] labels Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Affects: UI Issues with the web site's user interface. [managed] Lead: @mekarpeles Issues overseen by Mek (Staff: Program Lead) [managed] Priority: 3 Issues that we can consider at our leisure. [managed] Type: Bug Something isn't working. [managed]
Projects
None yet
Development

No branches or pull requests

2 participants