[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for single quote in alias #55

Open
woulf opened this issue Feb 3, 2016 · 10 comments
Open

Error for single quote in alias #55

woulf opened this issue Feb 3, 2016 · 10 comments
Labels
Milestone

Comments

@woulf
Copy link
woulf commented Feb 3, 2016

Hello,
as the title say even tough it is accepted by nagios, and valid in JSON string, i can't use single quote ( ' ) in alias (big problem for french).
I tried escaping it with the "'" form and with the "\u0027" forms with the same result.
I'm always getting an http 400 error so i guess that's on the nagrestconf webserver side that the problem lay?
Any idea how to solve that?
thanks

@mclarkson
Copy link
Owner

No work-around for that one I'm afraid. I'll need to add code to make it a url encoded field.
I'll get this into the next release. What OS are you using?

@mclarkson mclarkson added the bug label Feb 3, 2016
@mclarkson mclarkson added this to the 1.174.5/0.14.3 milestone Feb 3, 2016
mclarkson added a commit that referenced this issue Feb 3, 2016
@mclarkson
Copy link
Owner

I've got the code in place. It works but just need to test border cases.
Just let me know your OS so I can build for that first.

@woulf
Copy link
Author
woulf commented Feb 3, 2016

Hey, thanks for the quick answer!
I'm the guy with docker ^^ but basically that's a debian jessie

@mclarkson
Copy link
Owner

Aha :) Hi!
Surprisingly, for me, this now works in the alias field:

Næmon's Nôra Großen Café

Also, nrcq has been updated so it will work too:

$ nrcq http://NAGIOSHOST/rest show/hosts

    name:diskstation
    alias:Næmon's Nôra Großen Café
    ipaddress:127.0.0.1
    template:hsttmpl-local
    hostgroup:ds
    activechecks:on
    servicesets:diskstation nagios
    disable:0
    notes_url:/highcharts/highcharts.html?host=$HOSTNAME$
    action_url:/highcharts/highcharts.html?host=$HOSTNAME$

$ nrcq http://NAGIOSHOST/rest modify/hosts \
    -d "name:diskstation" \
    -d "alias:Nôra's Großen"
SUCCESS

$ nrcq http://NAGIOSHOST/rest show/hosts

    name:diskstation
    alias:Nôra's Großen
    ...

$ nrcq http://10.11.12.10:8888/rest show/hosts --json
[
  {
    "name":"diskstation",
    "alias":"N%C3%B4ra%27s+Gro%C3%9Fen",
    "ipaddress":"127.0.0.1",
    ...

Jessie .deb's are at sourceforge but I've not tried them so backup your configuration using the GUI before upgrading. I tested Centos 6 RPMS, which seemed to work.

Cheers!
Mark

@woulf
Copy link
Author
woulf commented Feb 5, 2016

ok got it in my build/test routine and everything is working as expected on nagrestconf side! :)
However i'm getting the results url-encoded trough "rest/show/hosts", instead of classical json way of dealing with it (not url encoded for ascii, \u+utf8 code for special character), nothing i can't deal with but i just want to check that's by design?
thanks! :)

@mclarkson
Copy link
Owner

Yep, that's what the fix was, an extra url encoding. Thanks for testing.

@woulf
Copy link
Author
woulf commented Feb 5, 2016

Perfect then, i'll do what needed on my app side,
thanks!

@woulf
Copy link
Author
woulf commented Feb 10, 2016

Hey there,
just so you know: the same bug happen on delete/hosts , not a big problem since alias isn't mandatory for this.
Do you think the same will happen for host modification? (havn't developped this part yet)

@woulf
Copy link
Author
woulf commented Feb 10, 2016

Coded the modification part Quickly: working perfectly!

@mclarkson
Copy link
Owner

Thanks for that Woulf. I'll open this again and fix it for show/hosts and delete/hosts. Even though having the alias field for show and delete is unnecessary, I'd still like to be able to reuse an add or modify line and only have to change the 'add' to 'delete' or 'show'.

@mclarkson mclarkson reopened this Feb 10, 2016
@mclarkson mclarkson modified the milestones: 1.174.7, 1.174.5/0.14.2 Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants