Skip to content

Commit

Permalink
FIX Make a redirect after the remove_file action to avoid deletion done
Browse files Browse the repository at this point in the history
at next action too.
  • Loading branch information
eldy committed Mar 19, 2018
1 parent 6ca40bc commit 8899b51
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions htdocs/core/actions_builddoc.inc.php
Expand Up @@ -124,5 +124,13 @@
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", $filetodelete), null, 'errors');

// Make a redirect to avoid to keep the remove_file into the url that create side effects
$urltoredirect = $_SERVER['REQUEST_URI'];
$urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect);
$urltoredirect = preg_replace('/action=remove_file&?/', '', $urltoredirect);

header('Location: '.$urltoredirect);
exit;
}

0 comments on commit 8899b51

Please sign in to comment.