mantisbt-plugins / source-integration

Source control integration plugin framework for MantisBT, including support for Github, Gitlab, Bitbucket, Gitea, Gitweb, Cgit, Subversion, Mercurial and more
http://noswap.com/projects/source-integration/
MIT License
181 stars 130 forks source link

CGit with Libravatar: value too long for type character varying(250) #386

Closed rick-gnous closed 2 years ago

rick-gnous commented 2 years ago

Some instances of CGit have a plugin for avatar using libravatar. It adds a span in the author field and, because of his length, raises "value too long for type character varying(250)". Check the code below to see the difference. I use the official cgit repo for example.

Without libravatar

<tr><th>author</th>
<td>Christian Hesse &lt;mail@eworm.de&gt;</td>
<td class="[right]()">2021-05-18 22:49:13 +0200</td></tr>
<tr><th>committer</th><td>Christian Hesse &lt;mail@eworm.de&gt;</td>
<td class="[right]()">2021-06-08 12:37:46 +0200</td></tr>

With libravatar

<tr><th>author</th>
<td><span class="[libravatar]()"><img class="[inline]()" src="[https://seccdn.libravatar.org/avatar/d39edb2018ca5544c1c390a8266096fb?s=13&amp;d=retro](view-source:https://seccdn.libravatar.org/avatar/d39edb2018ca5544c1c390a8266096fb?s=13&d=retro)"><img class="[onhover]()" src="[https://seccdn.libravatar.org/avatar/d39edb2018ca5544c1c390a8266096fb?s=128&amp;d=retro](view-source:https://seccdn.libravatar.org/avatar/d39edb2018ca5544c1c390a8266096fb?s=128&d=retro)"></span>Christian Hesse &lt;mail@eworm.de&gt;</td>
<td class="[right]()">2021-05-18 22:49:13 +0200</td></tr>
<tr><th>committer</th><td><span class="[libravatar]()"><img class="[inline]()" src="[https://seccdn.libravatar.org/avatar/d39edb2018ca5544c1c390a8266096fb?s=13&amp;d=retro](view-source:https://seccdn.libravatar.org/avatar/d39edb2018ca5544c1c390a8266096fb?s=13&d=retro)"><img class="[onhover]()" src="[https://seccdn.libravatar.org/avatar/d39edb2018ca5544c1c390a8266096fb?s=128&amp;d=retro](view-source:https://seccdn.libravatar.org/avatar/d39edb2018ca5544c1c390a8266096fb?s=128&d=retro)"></span>Christian Hesse &lt;mail@eworm.de&gt;</td>
<td class="[right]()">2021-06-08 12:37:46 +0200</td></tr>
dregad commented 2 years ago

Actual error was reported in https://github.com/mantisbt-plugins/source-integration/pull/377#issuecomment-1029590273

APPLICATION ERROR #401

Database query failed. Error received from database was #-1: ERROR: value too long for type character varying(250) for the query: INSERT INTO mantis_plugin_Source_changeset_table ( repo_id, revision, parent, branch, user_id,
timestamp, author, message, info, ported, author_email, committer, committer_email, committer_id
) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14 ).
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
dregad commented 2 years ago

I tried to use the sample output posted in https://github.com/mantisbt-plugins/source-integration/issues/386#issue-1123753149 to test the regex in #377, but the HTML seems strange (e.g. added newlines, &lt; entity, class name looks like Markdown link, double quotes instead of single) and does not match with the patterns in the code.

For the record, I used the following, manually modified versions for testing - I hope they're actually correct Cgit output.

<tr><th>author</th><td>Christian Hesse <mail@eworm.de></td><td class='right'>2021-05-18 22:49:13 +0200</td></tr>
<tr><th>author</th><td><span class='libravatar'><img class='inline' src='https://seccdn.libravatar.org/avatar/d39edb2018ca5544c1c390a8266096fb?s=13&amp;d=retro'><img class='onhover' src='https://seccdn.libravatar.org/avatar/d39edb2018ca5544c1c390a8266096fb?s=128&amp;d=retro'></span>Christian Hesse <mail@eworm.de></td><td class='right'>2021-05-18 22:49:13 +0200</td></tr>
rick-gnous commented 2 years ago

Yes, I've used the "View Selection Source" of Firefox to extract HTML. Good to know that it's reformat the code.