nkdAgility/azure-devops-migration-tools

[Bug]: Images Not Correctly Migrated from TFS Server URLs Containing Spaces

SamVanCutsem opened this issue · 2 comments

Version

  • I confirm that I am using the latest version

Source Version

Team Foundation Server 2015

Target Version

Azure DevOps Service

Relevant configuration

{
  "ChangeSetMappingFile": null,
  "Source": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://tfs.sometfsserver.internal/project%20with%20spaces",
    "Project": "migrationSource1",
    "ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
    "AllowCrossProjectLinking": false,
    "AuthenticationMode": "AccessToken",
    "PersonalAccessToken": "SomeAccessToken",
    "PersonalAccessTokenVariableName": "",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    }
  },
  "Target": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://dev.azure.com/project-without-spaces",
    "Project": "migrationTest5",
    "ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
    "AllowCrossProjectLinking": false,
    "AuthenticationMode": "AccessToken",
    "PersonalAccessToken": "SomeAccessToken",
    "PersonalAccessTokenVariableName": "",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    }
  },
  "FieldMaps": [],
  "GitRepoMapping": {},
  "LogLevel": "Debug",
  "CommonEnrichersConfig": [],
  "Processors": [
    {
      "$type": "WorkItemMigrationConfig",
      "Enabled": true,
      "UpdateCreatedDate": true,
      "UpdateCreatedBy": true,
      "WIQLQuery": "SELECT [System.Id] FROM WorkItems WHERE [System.Id] = 137 ORDER BY [System.ChangedDate] desc",
      "FixHtmlAttachmentLinks": true,
      "WorkItemCreateRetryLimit": 5,
      "FilterWorkItemsThatAlreadyExistInTarget": false,
      "PauseAfterEachWorkItem": false,
      "AttachRevisionHistory": false,
      "GenerateMigrationComment": false,
      "WorkItemIDs": null,
      "MaxGracefulFailures": 0,
      "SkipRevisionWithInvalidIterationPath": false,
      "SkipRevisionWithInvalidAreaPath": false
    }
  ],
  "Version": "15.0",
  "workaroundForQuerySOAPBugEnabled": false,
  "WorkItemTypeDefinition": {
    "Bug": "Bug",
    "Issue": "Issue",
    "Change Request": "Change Request",
    "Task": "Task",
  },
  "Endpoints": {
    "InMemoryWorkItemEndpoints": [
      {
        "Name": "Source",
        "EndpointEnrichers": null
      },
      {
        "Name": "Target",
        "EndpointEnrichers": null
      }
    ]
  }
}

Relevant log output

No response

What happened?

Hi

I've identified a bug has been in the TfsEmbededImagesEnricher Enrich functionality. This issue arises when handling image URLs from TFS Servers that include spaces in the organization name. During attempts to migrate images linked within HTML fields, if the source URLs contain spaces (encoded via %20), the images fail to migrate and continue to point to the old TFS Server. This may be due to mishandling of URL encoding and incorrect handling of legacy server references.

Steps to Reproduce:

  • Configure a TFS Server with an organizational name that includes spaces (e.g., https://tfs.sometfsserver.internal/project%20with%20spaces).
  • Use the WorkItemMigrationProcessor and enable FixHtmlAttachmentLinks to migrate an HTML fields containing references to images hosted on this server.
  • Observe that the images do not migrate correctly; their URLs in the migrated documents still point to the old TFS Server.

Debug in Visual Studio

  • Visual Studio Debug

Would you be able to submit a PR with correction?

I was busy creating the PR :-)