jsuto / piler

Email archiving application
https://www.mailpiler.org/
Other
82 stars 9 forks source link

[BUG] path prefix : search-helper.php not found #147

Closed th-2021 closed 3 months ago

th-2021 commented 3 months ago

POST https://tom-ml351/search-helper.php 404 (Not Found)

Prefix is missing.

nginx is correct: rewrite /mail/search-helper.php /mail/index.php?route=search/helper;

jsuto commented 3 months ago

Can you try the following fix?

--- a/webui/system/misc.php
+++ b/webui/system/misc.php
@@ -393,7 +393,7 @@ function escape_gt_lt_quote_symbols($s = '') {

 function get_search_url_by_page($page = 0) {

-   return "/search-helper.php?page=$page";
+   return PATH_PREFIX . 'search-helper.php?page=' . (int)$page;
th-2021 commented 3 months ago

No change. Prefix still missing

jsuto commented 3 months ago

Assuming the base_url is set in assets/js/piler.js, this is the only other place that references search-helper.php

th-2021 commented 3 months ago

My base_url change was lost, when I started the new image. It's working now.

How can I set the base_url? piler.js is part of the image. A patch by start,sh? Or is there an easier solution?

jsuto commented 3 months ago

An easier solution doesn't come to my mind, please apply your change again.

th-2021 commented 3 months ago

Fix for PATH_PREFIX

PATH_PREFIX=grep PATH_PREFIX /etc/piler/config-site.php | awk '{ print $3 }' | tr ";" "," sed -i -e "s#location.origin\ +\ .*#location.origin\ +\ $PATH_PREFIX#" /var/piler/www/assets/js/piler.js

To me the result looks ok, but firefox throws an error: Uncaught SyntaxError: missing } after property listpiler.js:8:43note: { opened at line 2, column 1

Chrome works.

th-2021 commented 3 months ago

firefox error was a cache issue. firefox works as well