Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

ID Templates #262

Closed
janstanka opened this issue Oct 25, 2017 · 10 comments
Closed

ID Templates #262

janstanka opened this issue Oct 25, 2017 · 10 comments
Milestone

Comments

@janstanka
Copy link

janstanka commented Oct 25, 2017

Impossible to submit ID template settings values (name, URL).
example->
name: "Databaze knih"
URL: "https://www.databazeknih.cz/knihy/%id%"

BBS ver. 1.3.6 (Synology DSM package)
browser Firefox 56.0.1 (64bit)

@rvolz
Copy link
Owner

rvolz commented Oct 27, 2017

Could you please explain the problem? I just checked and the templates seem to work ...

@janstanka
Copy link
Author

I'm sending images of configuring template in steps.

  1. step
    1 step
  2. step
    2 step
  3. step
    3 step
  4. step
    4 step
    result
    5 step - result

I've tried on Firefox, MSIE 11, Chrome on Android and Dolphin on Android with same behaviour.

@rvolz
Copy link
Owner

rvolz commented Oct 30, 2017

Ok, thanks. I tried to replicate your problem. I entered the same URL, see pic, and everything worked (green), as it should:
bildschirmfoto 2017-10-30 um 15 48 38

The generated links worked to:

bildschirmfoto 2017-10-30 um 15 55 15

Maybe the error message indicates the problem. If you could switch on debug mode then you could look at the log files in the data folder. There should be warning or error messages explaining the "bad parameter" error shown in your pictures.

@janstanka
Copy link
Author

I switched BBS to debug mode and here is the part of log:

INFO - 2017-10-31T08:12:09+01:00 - BicBucStriim 1.3.6: Running in debug mode.
DEBUG - 2017-10-31T08:12:09+01:00 - caching_middleware: caching disabled for /admin/idtemplates/databazeknih
INFO - 2017-10-31T08:12:09+01:00 - multi user mode: login required
DEBUG - 2017-10-31T08:12:09+01:00 - own_config_middleware: config loaded
DEBUG - 2017-10-31T08:12:09+01:00 - login resource: /admin/idtemplates/databazeknih
DEBUG - 2017-10-31T08:12:09+01:00 - after resume: VALID
WARN - 2017-10-31T08:12:09+01:00 - admin_modify_idtemplate: invalid template id databazeknih

@rvolz
Copy link
Owner

rvolz commented Oct 31, 2017

It seems there is a problem with the id databazeknih, which produces the error. As far as I can see from your pics and logs the ID looks like an ASCII string. The ASCII string databazeknih would of course work as an ID. However, the warning in the log says: it isn't an ASCII string.

Could you please check for non-ASCII characters in this ID? See Identifiers in Calibre.

@janstanka
Copy link
Author

I did not found any non-ASCII chars in string. But I tryed the same procedure with ISBN identifier with values:
Display text: "isbn"
URL: "https://isbnsearch.org/isbn/%id%"
and the result was the same - Bad parametr (same as on 5-th. picture). I remember that in some previous version of BBS was it functional (maybe 1 year ago).

@rvolz
Copy link
Owner

rvolz commented Nov 1, 2017

It still is functional, at least over here. There must be some encoding issue.

There is a change that could help with this issue. Could you please try that out? if it works for you I'll add it to the new version:

In index.php change the line 394

   // parameter checking
    if (!preg_match('/^\w+$/',$id)) { // <-- this one
        $app->getLog()->warn('admin_modify_idtemplate: invalid template id ' . $id);
        $app->halt(400, "Bad parameter");
    }

to

    if (!preg_match('/^\w+$/u',$id)) { 

The "u" adds unicode support and should solve the problem. Repeat the same for line 433.

@janstanka
Copy link
Author

My index.php is looking different. Look at lines 394 and 433.
index.zip

@janstanka
Copy link
Author

But changed lines 393 and 432 and IT WORKS!

@rvolz
Copy link
Owner

rvolz commented Nov 1, 2017

Glad to hear that. I'll add it to the code and will release 1.3.7 soon

@rvolz rvolz added this to the 1.4.0 milestone Nov 1, 2017
@rvolz rvolz closed this as completed in 6a89d3b Nov 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants