adyscorpius / logseq-jira

A simple Jira plugin for Logseq users
MIT License
38 stars 11 forks source link

Square brackets in summary cause errors #20

Open jwhonce opened 2 months ago

jwhonce commented 2 months ago

Describe the bug If the Jira summary contains square brackets, then updating will cause the URL in the block to become corrupted. Enabling the experimental auto refresh, will eventually rewrite the URLs until errors are thrown on startup.

To Reproduce Steps to reproduce the behavior:

  1. Create a block with with a Jira issue key where the summary includes a square bracket
  2. Invoke /Jira: Update Issue
  3. Note block and URL are as expected
  4. Now invoke /Jira: Update Issue a second time
  5. Note how URL has been rewritten, each update will further corrupt the URL

Expected behavior /Jira: Update Issue should rewrite the block information updating information that has changed.

Screenshots From journal file:

- initial invocation of Update Issue
- [⚪️ To Do - RUN-1914|[SPIKE] Investigate other CI-solutions](https://issues.redhat.com/browse/RUN-1914)
  assignee:: Lokesh Mandvekar
  priority:: Major
  status:: To Do

- second invocation of Update Issue
- [⚪️ To Do - [⚪️ To Do - RUN-1914|[SPIKE] Investigate other CI-solutions](https://issues.redhat.com/browse/RUN-1914)|[SPIKE] Investigate other CI-solutions](https://issues.redhat.com/browse/RUN-1914)
  assignee:: Lokesh Mandvekar
  priority:: Major
  status:: To Do

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

{
  "primarySettings": null,
  "jiraBaseURL": "issues.redhat.com",
  "jiraUsername": "user@redhat.com",
  "jiraAPIToken": "...",
  "jiraAuthType": "PAT",
  "jiraAPIVersion": "2",
  "enableBlockPropertiesHeading": null,
  "updateInlineText": true,
  "autoRefresh": "No",
  "enableOrgMode": false,
  "addToBlockProperties": true,
  "showSummary": false,
  "showAssignee": true,
  "showPriority": true,
  "showFixVersion": false,
  "showStatus": true,
  "showReporter": false,
  "showResolution": true,
  "secondOrgHeading": null,
  "enableSecond": false,
  "jiraBaseURL2": "orgname2.atlassian.net",
  "jiraUsername2": "",
  "jiraAPIToken2": "",
  "jiraAuthType2": "Basic Auth",
  "jiraAPIVersion2": "3",
  "queriesJQL": null,
  "jqlQueryTitle": "",
  "jqlQuery": "assignee= currentUser() AND statusCategory != Done and Updated >= -30d",
  "disabled": false
}
adyscorpius commented 2 months ago

Hey, great catch! I was wondering why it was happening in some cases but not others, until you pointed out the nested brackets. Thanks, it's fixed in the new release. Let me know if it doesn't work, and we can reopen the issue.

Here you go!

https://github.com/adyscorpius/logseq-jira/releases/tag/v0.6.1

jwhonce commented 2 months ago

@adyscorpius

I downloaded 0.6.1.zip and installed it as an unpackaged plugin. The initial lookup works, the update lookup now fails with:

image

adyscorpius commented 2 months ago

Hi @jwhonce,

Do you have other requests working fine and only this one giving an error? Can you share the headers being sent by a successful and failing request? (Please make sure you remove any API keys and randomize the endpoint.)