K-Phoen / backstage-plugin-confluence

Confluence plugins for backstage
MIT License
52 stars 15 forks source link

Discrepancy in Data Fields and HTML Parsing Issue #191

Open Prateek-Wayne opened 6 months ago

Prateek-Wayne commented 6 months ago

I’ve noticed a discrepancy in the data fields returned by the getDocumentInfo function in the Backstage plugin for Confluence. Specifically, the lastModifiedBy field is expected to be data.version.by.publicName, but in the data returned from Confluence for my organization, the equivalent field is data.version.by.displayName.

Here’s the current return statement:

return [{ title: data.title, text: this.stripHtml(data.body.storage.value), location:${this.wikiUrl}${data._links.webui}, spaceKey: data.space.key, spaceName: data.space.name, ancestors: ancestors, lastModifiedBy: data.version.by.publicName, lastModified: data.version.when, lastModifiedFriendly: data.version.friendlyWhen }];

And here’s what would work for my organization’s data:

return [ { title: data.title, text: this.stripHtml(data.body.storage.value), location:${this.wikiUrl}${data._links.webui}, spaceKey: data.space.key, spaceName: data.space.name, ancestors: ancestors, lastModifiedBy: data.version.by.displayName, lastModified: data.version.when, lastModifiedFriendly: new Date(data.version.when).toLocaleDateString(), }, ];

Additionally, I’ve found an issue with the stripHtml function. It doesn’t seem to be stripping HTML tags in a reliable manner, and some unwanted special characters are still left in the output.

I would appreciate it if these issues could be looked into