View ID appended at download URL from another Mahara site

Bug #1702748 reported by Kristina Hoeppner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Robert Lyon
18.10
Fix Released
Medium
Robert Lyon

Bug Description

Checked in 16.10 -> 17.04

When you have a public file on one Mahara site, link that for example in a journal entry on another Mahara site and make the page public, the file gets the viewID of that page appended even though there is no reason for it. It seems that Mahara only checks that /artefact/file/download.php?file= is present no matter the domain and then simply appends the viewID.

To replicate:

1. Log into Mahara instance 1.
2. Upload a file into Admin menu -> Configure site -> Files -> Public.
3. Add the file to the public menu (to ensure that you are copying the correct download link that is available to people when not logged in): Admin menu -> Configure site -> Menus -> Public...
4. Copy the file's location. It should look something like http://domain.tld/artefact/file/download.php?file=XXXX
5. Log out of Mahara instance 1.
6. Log into Mahara instance 2.
7. Write a journal entry and link some text to the file. Save the entry.
8. Add your journal to a page and make it public.
9. View the page and hover over the link.

Expected result: The link looks exactly the same as before and you can reach the file as it is a public one.
Actual result: The link has a viewID appended, e.g. http://domain.tld/artefact/file/download.php?file=XXXX&view=YYY and if you are not logged into Mahara instance 1, you can't view it.

Tags: snack-sized
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 17.10.0 → 18.04.0
no longer affects: mahara/18.04
tags: added: snack-sized
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 18.04.0 → 18.04.1
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/8794

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/8794
Committed: https://git.mahara.org/mahara/mahara/commit/b739c1e8d82d335c9aa4dd812872b36095e93903
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit b739c1e8d82d335c9aa4dd812872b36095e93903
Author: Robert Lyon <email address hidden>
Date: Tue Apr 10 14:14:31 2018 +1200

Bug 1702748: append_view_url() needs to respect site

Currently there is a regex to append the view id to the embedded url
But it doesn't take into account the domain of the site

If you use a link from anther mahara it tries to append the viewid of
the page the link is being used in causing confusion

behatnotneeded

Change-Id: Iece12b1c993d53cdf48e13da16af1156e3ddc9e2
Signed-off-by: Robert Lyon <email address hidden>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.