Unverified Commit 0f033804 authored by mvdbeek's avatar mvdbeek
Browse files

Merge branch 'release_22.01' into release_22.05

parents c2aa3b73 5785342a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -531,6 +531,8 @@ class BamNative(CompressedArchive, _BamOrSam):
        file_paths = []
        rel_paths.append(f"{name or dataset.file_name}.{dataset.extension}")
        file_paths.append(dataset.file_name)
        # We may or may not have a bam index file (BamNative doesn't have it, but also index generation may have failed)
        if dataset.metadata.bam_index:
            rel_paths.append(f"{name or dataset.file_name}.{dataset.extension}.bai")
            file_paths.append(dataset.metadata.bam_index.file_name)
        return zip(file_paths, rel_paths)
+3 −7
Original line number Diff line number Diff line
@@ -14,10 +14,7 @@ from typing import (
    Any,
    Dict,
)
from urllib.parse import (
    urljoin,
    urlparse,
)
from urllib.parse import urlparse

import mako.lookup
import mako.runtime
@@ -466,7 +463,7 @@ class GalaxyWebTransaction(base.DefaultWebTransaction, context.ProvidesHistoryCo
                if name not in self.request.cookies and TOOL_RUNNER_SESSION_COOKIE in self.request.cookies:
                    # TOOL_RUNNER_SESSION_COOKIE value is the encoded galaxysession cookie.
                    # We decode it here and pretend it's the galaxysession
                    tool_runner_path = urljoin(self.app.config.galaxy_url_prefix, "tool_runner")
                    tool_runner_path = url_for(controller="tool_runner")
                    if self.request.path.startswith(tool_runner_path):
                        return self.security.decode_guid(self.request.cookies[TOOL_RUNNER_SESSION_COOKIE].value)
                return self.request.cookies[name].value
@@ -482,13 +479,12 @@ class GalaxyWebTransaction(base.DefaultWebTransaction, context.ProvidesHistoryCo
            self._set_cookie(
                value,
                name=TOOL_RUNNER_SESSION_COOKIE,
                path=urljoin(path, "tool_runner"),
                path=url_for(controller="tool_runner"),
                age=age,
                version=version,
                encode_value=True,
            )
            tool_runner_cookie = self.response.cookies[TOOL_RUNNER_SESSION_COOKIE]
            tool_runner_cookie["path"] = urljoin(path, "tool_runner")
            tool_runner_cookie["SameSite"] = "None"
            tool_runner_cookie["secure"] = True

+7 −32
Original line number Diff line number Diff line
@@ -863,14 +863,7 @@ class DatasetInterface(BaseUIController, UsesAnnotations, UsesItemRatings, UsesE
        id = None
        try:
            id = self.decode_id(dataset_id)
            hda = trans.sa_session.query(self.app.model.HistoryDatasetAssociation).get(id)
            assert hda, f"Invalid HDA: {id}"
            # Walk up parent datasets to find the containing history
            topmost_parent = hda
            while topmost_parent.parent:
                topmost_parent = topmost_parent.parent
            assert topmost_parent in trans.history.datasets, "Data does not belong to current history"
            # Mark deleted and cleanup
            hda = self.hda_manager.get_owned(id, trans.user, current_history=trans.history)
            hda.mark_deleted()
            hda.clear_associated_files()
            trans.log_event(f"Dataset id {str(id)} marked as deleted")
@@ -889,17 +882,8 @@ class DatasetInterface(BaseUIController, UsesAnnotations, UsesItemRatings, UsesE
        id = None
        try:
            id = self.decode_id(dataset_id)
            history = trans.get_history()
            hda = trans.sa_session.query(self.app.model.HistoryDatasetAssociation).get(id)
            assert hda and hda.undeletable, f"Invalid HDA: {id}"
            # Walk up parent datasets to find the containing history
            topmost_parent = hda
            while topmost_parent.parent:
                topmost_parent = topmost_parent.parent
            assert topmost_parent in history.datasets, "Data does not belong to current history"
            # Mark undeleted
            hda.mark_undeleted()
            trans.sa_session.flush()
            item = self.hda_manager.get_owned(id, trans.user, current_history=trans.history)
            self.hda_manager.undelete(item)
            trans.log_event(f"Dataset id {str(id)} has been undeleted")
        except Exception:
            msg = f"HDA undeletion failed (encoded: {dataset_id}, decoded: {id})"
@@ -912,21 +896,12 @@ class DatasetInterface(BaseUIController, UsesAnnotations, UsesItemRatings, UsesE
    def _unhide(self, trans, dataset_id):
        try:
            id = self.decode_id(dataset_id)
        except Exception:
            return False
        history = trans.get_history()
        hda = trans.sa_session.query(self.app.model.HistoryDatasetAssociation).get(id)
        if hda:
            # Walk up parent datasets to find the containing history
            topmost_parent = hda
            while topmost_parent.parent:
                topmost_parent = topmost_parent.parent
            assert topmost_parent in history.datasets, "Data does not belong to current history"
            # Mark undeleted
            hda.mark_unhidden()
            item = self.hda_manager.get_owned(id, trans.user, current_history=trans.history)
            item.mark_unhidden()
            trans.sa_session.flush()
            trans.log_event(f"Dataset id {str(id)} has been unhidden")
            return True
        except Exception:
            return False

    def _purge(self, trans, dataset_id):