varfish-org / varfish-server

VarFish: comprehensive DNA variant analysis for diagnostics and research
MIT License
43 stars 11 forks source link

varfish-kiosk always displays error after upload #148

Closed holtgrewe closed 3 years ago

holtgrewe commented 3 years ago

Describe the bug varfish-kiosk always displays an error after upload.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://varfish-kiosk.bihealth.org
  2. Upload any VCF and optionally PED file.
  3. The variant is annotated, followed by a redirect to a HTTP 500.

Expected behavior No HTTP 500. ;-)

Screenshots When activating debug mode temporarily.

image

Additional context Add any other context about the problem here.

mikkonie commented 3 years ago

If I'm following this correctly, the view should redirect to CaseDetailView which uses the template variants/case_detail.html.

Assuming this is true, I can spot a few things wrong in the template for starters. It inherits project_base.html but overrides the entire projectroles block, so nothing from project_base.html is actually used. That's not what's breaking this, but if you don't use the projectroles_extend there's no reason to inherit project_base.html, just use base.html instead.

Now, as for the actual bug. I can't reproduce this with the standard base templates in the current SODAR Core version. Probably whatever explodes has already been fixed in v0.10.x. However, here's something you can try in the template.

Take the following bits:

{% get_app_setting 'userprofile' 'enable_project_uuid_copy' user=request.user as enable_uuid_copy %}
<a role="submit" class="btn btn-link mr-2 sodar-pr-btn-title sodar-pr-btn-copy-uuid sodar-copy-btn"
     id="sodar-pr-btn-copy-uuid"
     data-clipboard-text="{{ object.sodar_uuid }}"
     title="Copy UUID to clipboard" data-toggle="tooltip" data-placement="top">
    <i class="fa fa-clipboard text-muted" aria-hidden="true"></i>
  </a>

..and refactor them into something like:

{% if request.user and request.user.is_authenticated %}
  {% get_app_setting 'userprofile' 'enable_project_uuid_copy' user=request.user as enable_uuid_copy %}
  {% if enable_uuid_copy %}
    <a role="submit" class="btn btn-link mr-2 sodar-pr-btn-title sodar-pr-btn-copy-uuid sodar-copy-btn"
         id="sodar-pr-btn-copy-uuid"
         data-clipboard-text="{{ object.sodar_uuid }}"
         title="Copy UUID to clipboard" data-toggle="tooltip" data-placement="top">
        <i class="fa fa-clipboard text-muted" aria-hidden="true"></i>
      </a>
  {% endif %}
{% endif %}

Of course, if you want anonymous users in kiosk mode to be able to copy the UUID, this will look a bit different. The main thing is, don't call get_app_setting() for a user-specific setting with AnonymousUser. I'll make double sure this can't cause a crash in v0.10.2.

holtgrewe commented 3 years ago

Fixed in dd543a961f6402fcebbff3e9ab6b4a3aef046fee and deployed to varfish-kiosk.

stolpeo commented 3 years ago

Thanks @mikkonie !

Fixed with #151