jira-azuredevops-migrator icon indicating copy to clipboard operation
jira-azuredevops-migrator copied to clipboard

Feature request: Enable image rendering for multiline text fields

Open C-F-Palmer opened this issue 2 years ago • 11 comments

This is related to my previous issue #585 which was reported as fixed and is now closed.

I have taken the latest build from Master and run the Export successfully but the Import throws one error and does not display the images in ADO.

The images are displayed in the images tab correctly with the naming conventions as described in the fix however they are still not appearing the Description field and the Fixed Description field I have:

image

image

In the latest released version 2.3.117 this was a problem too but it was displaying in the description field and not the Fixed Description field. Please refer to my original issue for more detail on this #510.

The error message that I get when running the Import is as follows:

[E][12:28:16] Failed to correct description for '44990', rev ''DEF-15450', rev 3'. [System.IndexOutOfRangeException] System.IndexOutOfRangeException: Index was outside the bounds of the array. at WorkItemImport.WitClientUtils.<>c__DisplayClass28_0.<IdentifyAttachment>b__0(WorkItemRelation a) at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate) at WorkItemImport.WitClientUtils.IdentifyAttachment(WiAttachment att, WorkItem wi, IsAttachmentMigratedDelegate3 isAttachmentMigratedDelegate) at WorkItemImport.WitClientUtils.CorrectImagePath(WorkItem wi, WiItem wiItem, WiRevision rev, String& textField, Boolean& isUpdated, IsAttachmentMigratedDelegate3 isAttachmentMigratedDelegate) at WorkItemImport.WitClientUtils.CorrectDescription(WorkItem wi, WiItem wiItem, WiRevision rev, IsAttachmentMigratedDelegate3 isAttachmentMigratedDelegate) at WorkItemImport.Agent.ImportRevision(WiRevision rev, WorkItem wi): at WorkItemImport.WitClientUtils.<>c__DisplayClass28_0.<IdentifyAttachment>b__0(WorkItemRelation a) at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate) at WorkItemImport.WitClientUtils.IdentifyAttachment(WiAttachment att, WorkItem wi, IsAttachmentMigratedDelegate3 isAttachmentMigratedDelegate) at WorkItemImport.WitClientUtils.CorrectImagePath(WorkItem wi, WiItem wiItem, WiRevision rev, String& textField, Boolean& isUpdated, IsAttachmentMigratedDelegate3 isAttachmentMigratedDelegate) at WorkItemImport.WitClientUtils.CorrectDescription(WorkItem wi, WiItem wiItem, WiRevision rev, IsAttachmentMigratedDelegate3 isAttachmentMigratedDelegate) at WorkItemImport.Agent.ImportRevision(WiRevision rev, WorkItem wi)

The reason I have raised this again as I am not sure that the issue I am experiencing would have been fixed by the changes described in #585

Thanks

Chris

C-F-Palmer avatar Oct 31 '22 13:10 C-F-Palmer

I'll have a look at it this week. I have also noticed that that images in comments don't seem to always show up either.

Alexander-Hjelm avatar Oct 31 '22 14:10 Alexander-Hjelm

Confirmed the error on my side, same error message. Looking into it now :)

Alexander-Hjelm avatar Nov 03 '22 10:11 Alexander-Hjelm

Thanks Alexander.

C-F-Palmer avatar Nov 03 '22 11:11 C-F-Palmer

Fixed in https://github.com/solidify/jira-azuredevops-migrator/pull/592

Alexander-Hjelm avatar Nov 03 '22 12:11 Alexander-Hjelm

@C-F-Palmer, please report whether #592 has resolved your issue or not :)

Alexander-Hjelm avatar Nov 04 '22 08:11 Alexander-Hjelm

Hi Alexander,

We have some progress here. The image in the Description field is now displaying however the image in the Fixed Description field is still not displaying.

For the image that is displaying correctly in the description field it is using the following image address:

https://dev.azure.com/************/a26a5a50-a0a5-455c-8cb6-b61f1fb13ea8/_apis/wit/attachments/a8a66c27-d194-48c2-ad90-df987d853db4

And the image that is not displaying correctly in the Fixed Description filed (Text Field in ADO) is using the following image address:

https://dev.azure.com/jira/secure/attachment/61393/61393_image-2021-02-08-11-34-26-465.png

Both images are displaying correctly in the Attachments tab in ADO.

C-F-Palmer avatar Nov 04 '22 12:11 C-F-Palmer

@C-F-Palmer What is "Fixed Description"? A custom text field?

If so, we have not implemented any url mapping for any other fields than Description and System.History (comments), which are the only fields that can render attachments.

Out of curiosity, why would you need to have an image url in a text field, since it would not render as an image anyway? Is the file attachment on the workitem not good enough?

Alexander-Hjelm avatar Nov 04 '22 12:11 Alexander-Hjelm

I'm pretty certain that this is the way we intend to keep it.

If you are interested in writing a custom solution for your use case, you can modify your target work item field in Agent.UpdateWIFields(). Here you could make a call to WitClientUtils.CorrectImagePath() (the url mapper function) and ensure that your custom field has the URL fixed.

Alexander-Hjelm avatar Nov 04 '22 12:11 Alexander-Hjelm

@C-F-Palmer What is "Fixed Description"? A custom text field?

If so, we have not implemented any url mapping for any other fields than Description and System.History (comments), which are the only fields that can render attachments.

Out of curiosity, why would you need to have an image url in a text field, since it would not render as an image anyway? Is the file attachment on the workitem not good enough?

I am just trying to replicate how it appears in our Jira instance. We have a field in Jira named fixed description which is a multi line text field which displays images. It is a wiki style renderer.

Just trying to replicate.

C-F-Palmer avatar Nov 04 '22 14:11 C-F-Palmer

Thanks Alexander for your help with this.

C-F-Palmer avatar Nov 04 '22 15:11 C-F-Palmer

I've relabeled this is a feature request.

The feature you are asking for is to "enable image rendering for multiline text fields". I have updated the issue title as well.

I'll check with the team if this is desirable or not, but we will likely not proceed with it anytime soon, since the priority now is to root out any remaining bugs ahead of the 3.0 release.

Until then you can always implement a solution yourself, like I mentioned here: https://github.com/solidify/jira-azuredevops-migrator/issues/591#issuecomment-1303422656

Alexander-Hjelm avatar Nov 07 '22 12:11 Alexander-Hjelm