pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16816: Unexpected escaping of html output
2+ messages / 2 participants
[nested] [flat]

* BUG #16816: Unexpected escaping of html output
@ 2021-01-08 10:29 PG Bug reporting form <noreply@postgresql.org>
  2021-01-08 11:02 ` Re: BUG #16816: Unexpected escaping of html output Jeroen Baten <jbaten@i2rs.nl>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2021-01-08 10:29 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: jbaten@i2rs.nl

The following bug has been logged on the website:

Bug reference:      16816
Logged by:          Jeroen Baten
Email address:      jbaten@i2rs.nl
PostgreSQL version: 12.5
Operating system:   Ubuntu Linux 20.04
Description:        

Hi,

I am not sure if this is a bug, but I can't see to find any place
(web/books/google/irc) that has a solution to my problem.
So, in the end, I turn to the development team.

My problem is: I use psql --html to generate output that I then transform to
pdf using wkhtmltopdf.
psql --html escapes html that I purposely enter into the select statement.
(As I user I would like to be able to generate html in my select statements,
even when using the html format output format)

Example:
Running psql --html

select format('<a
href="https://zammad.thuis.local#ticket/zoom/%s">%s</a>',t.number,t.number)
as TicketID from tickets as t, users as u where t.owner_id=u.id and
date(t.close_at) is null and t.owner_id=u.id order by t.close_at limit 1 ;


<table border="1">
  <tr>
    <th align="center">ticketid</th>
  </tr>
  <tr valign="top">
    <td align="left">&lt;a
href=&quot;https://zammad.thuis.local#ticket/zoom/85117&quot;&gt;85117&lt;/a&gt;</td;
  </tr>
</table>
<p>(1 row)<br />
</p>

Running psql without --html

                             ticketid                             
------------------------------------------------------------------
 <a href="https://zammad.thuis.local#ticket/zoom/85117">85117</a;

Any and all help is highly appriciated.
Kind regards,
Jeroen Baten
<jbaten@i2rs.nl>



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #16816: Unexpected escaping of html output
  2021-01-08 10:29 BUG #16816: Unexpected escaping of html output PG Bug reporting form <noreply@postgresql.org>
@ 2021-01-08 11:02 ` Jeroen Baten <jbaten@i2rs.nl>
  0 siblings, 0 replies; 2+ messages in thread

From: Jeroen Baten @ 2021-01-08 11:02 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

Fixed it.

select
'<tr>',
format('<td><a
href="${baseurl}#ticket/zoom/%s">%s</a></li></td>',t.id,t.number) as
TicketID,
'</tr>'
from tickets as t, users as u

psql -h ${host} -U zammad zammad  --tuples-only -AF ' '  -c "${query}"

Works!

Op 08-01-2021 om 11:29 schreef PG Bug reporting form:
> The following bug has been logged on the website:
>
> Bug reference:      16816
> Logged by:          Jeroen Baten
> Email address:      jbaten@i2rs.nl
> PostgreSQL version: 12.5
> Operating system:   Ubuntu Linux 20.04
> Description:        
>
> Hi,
>
> I am not sure if this is a bug, but I can't see to find any place
> (web/books/google/irc) that has a solution to my problem.
> So, in the end, I turn to the development team.
>
> My problem is: I use psql --html to generate output that I then transform to
> pdf using wkhtmltopdf.
> psql --html escapes html that I purposely enter into the select statement.
> (As I user I would like to be able to generate html in my select statements,
> even when using the html format output format)
>
> Example:
> Running psql --html
>
> select format('<a
> href="https://zammad.thuis.local#ticket/zoom/%s">%s</a>',t.number,t.number)
> as TicketID from tickets as t, users as u where t.owner_id=u.id and
> date(t.close_at) is null and t.owner_id=u.id order by t.close_at limit 1 ;
>
>
> <table border="1">
>   <tr>
>     <th align="center">ticketid</th>
>   </tr>
>   <tr valign="top">
>     <td align="left">&lt;a
> href=&quot;https://zammad.thuis.local#ticket/zoom/85117&quot;&gt;85117&lt;/a&gt;</td;
>   </tr>
> </table>
> <p>(1 row)<br />
> </p>
>
> Running psql without --html
>
>                              ticketid                             
> ------------------------------------------------------------------
>  <a href="https://zammad.thuis.local#ticket/zoom/85117">85117</a;
>
> Any and all help is highly appriciated.
> Kind regards,
> Jeroen Baten
> <jbaten@i2rs.nl>
>
-- 
Jeroen Baten              | EMAIL :  JBATEN@I2RS.NL
 ____  _  __              | web   :  www.i2rs.nl
  |  )|_)(_               | tel   :  +31 (0)648519096
 _|_/_| \__)              | Frisolaan 16, 4101 JK, Culemborg, the Netherlands

Attachments:

  pEpkey.asc (application/pgp-keys, 1.5K) download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-01-08 11:02 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 10:29 BUG #16816: Unexpected escaping of html output PG Bug reporting form <noreply@postgresql.org>
2021-01-08 11:02 ` Jeroen Baten <jbaten@i2rs.nl>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox