Wrong redirect for CSV-Upload Users when Mahara is in subdir

Bug #1843537 reported by Jochen K
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Unassigned
19.04
Fix Released
Medium
Unassigned
19.10
Fix Released
Medium
Unassigned

Bug Description

Greetings from germany.

When we upload users via CSV and Mahara is installed in a subdirectory (https://dns/mahara
The users were created but the redirect of the pages goes to https://dns/admin/users/uploadcsv.php

Is there a bug like in filepicker.

Thanks
Jochen

Revision history for this message
Jochen K (jochen-kinsinger) wrote :

Maybe i found the error:

in html\admin\users\uploadcsv.php on line 499

<code>
redirect('/admin/users/uploadcsv.php');
</code>

should be:
<code>
redirect(get_config('wwwroot').'admin/users/uploadcsv.php
</code>

similar to line 45

Revision history for this message
Jochen K (jochen-kinsinger) wrote :

Sorry working code should be:

redirect(get_config('wwwroot').'admin/users/uploadcsv.php')

in the same way i replaced all places where
<code>
'/admin/users/*'
</code>

exists with code:

<code>
get_config('wwwroot').'/admin/users/*'
</code>

Now it works on my system.

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Rebecca, can you please check if you experience the same and if you do, check if Jochen's code works?

Revision history for this message
Rebecca Blundell (rjb-dev) wrote :

I get the same incorrect redirect when Mahara is in a subdirectory with uploading by csv, however changing line 500 in htdocs/admin/users/uploadcsv.php did not resolve the issue. Jochen recommends also changing all occurrences of the redirect without using the wwwroot as a parameter, so perhaps one of these others is what fixed the issue for his site.

I wondered whether all of the redirects without the wwwroot would fail if Mahara was in a subdirectory, but this was not the case:
I tested a user deleting themselves which runs in mahara/htdocs/account/delete.php -
ln 116: redirect('/account/index.php');
Also creating a user in mahara/htdocs/admin/users/add.php -
ln 375: redirect('/admin/users/edit.php?id=' . $user->id);

For this reason, I'd be reluctant to do a blanket find and replace without knowing exactly

Revision history for this message
Rebecca Blundell (rjb-dev) wrote :

I accidently pressed enter too soon:
I'd be reluctant to do a blanket find and replace without knowing exactly what is causing the redirect to fail.

This needs a bit more investigation.

Revision history for this message
Jochen K (jochen-kinsinger) wrote :

I have to correct my report.

I reverted the original file and only change

in html\admin\users\uploadcsv.php on line 499

<code>
redirect('/admin/users/uploadcsv.php');
</code>

should be:
<code>
redirect(get_config('wwwroot').'admin/users/uploadcsv.php
</code>

similar to line 45

Now the csv upload works as expected . No other changes were done in uploadcsv.php.

Sorry i wrote to fast but tested too slow.

Any other changes i wrote produce errors on site, as Rebacaa wrote.

Soryy my mistake.

Cheers
Jochen

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/10393

Revision history for this message
Lisa Seeto (lisaseeto) wrote : Re: CSV-Upload Users

Hi All,

In order to get a correct redirect, the redirect had to be changed in the form->reply function on line 654:
'goto' => '/admin/users/uploadcsv.php',
changed to:
'goto' => get_config('wwwroot').'admin/users/uploadcsv.php',

ln 499 refers to a redirect for when an admin attempts to add more than the maximum users allowed into an institution via upload of csv file. I tested this also but uncovered a bug affecting both instances of mahara in subdirectories and those not in sudirectories where the application hangs and the progress bar attempts to update the progress continuously until a refresh of the page. This issue was addressed in a patch that changed that redirect to a form-> reply with PIEFORM_ERR code.

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

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

commit 49a7129229b6bebd7f77cd2492a3a876f5e4fcd8
Author: Lisa Seeto <email address hidden>
Date: Thu Oct 3 17:39:11 2019 +1300

Bug 1843537: CSV-Upload Users redirecting to invalid url for subdirectory mahara

- added get_config(wwwroot) to redirect url on form success
- changed SESSION msg and redirect to a form reply with error code

behatnotneeded

Change-Id: I5a8a9e3b9450b5c9c44495811948eca1f52e56cd
Signed-off-by: Lisa Seeto <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "19.04_STABLE" branch: https://reviews.mahara.org/10415

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

Reviewed: https://reviews.mahara.org/10415
Committed: https://git.mahara.org/mahara/mahara/commit/b09a9fa133a781f00b3c22db89786f8bca95bda6
Submitter: Robert Lyon (<email address hidden>)
Branch: 19.04_STABLE

commit b09a9fa133a781f00b3c22db89786f8bca95bda6
Author: Lisa Seeto <email address hidden>
Date: Thu Oct 3 17:39:11 2019 +1300

Bug 1843537: CSV-Upload Users redirecting to invalid url for subdirectory mahara

- added get_config(wwwroot) to redirect url on form success
- changed SESSION msg and redirect to a form reply with error code

behatnotneeded

Change-Id: I5a8a9e3b9450b5c9c44495811948eca1f52e56cd
Signed-off-by: Lisa Seeto <email address hidden>
(cherry picked from commit 49a7129229b6bebd7f77cd2492a3a876f5e4fcd8)

Robert Lyon (robertl-9)
no longer affects: mahara/18.10
summary: - CSV-Upload Users
+ Wrong redirect for CSV-Upload Users when Mahara is in subdir
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.