nkdAgility / azure-devops-migration-tools

Azure DevOps Migration Tools allow you to migrate Teams, Backlogs, Tasks, Test Cases, and Plans & Suits from one Project to another in Azure DevOps / TFS both within the same Organisation, and between Organisations.
https://marketplace.visualstudio.com/items?itemName=nkdagility.vsts-sync-migration
MIT License
475 stars 322 forks source link

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

Closed SamVanCutsem closed 1 month ago

SamVanCutsem commented 1 month ago

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:

Debug in Visual Studio

MrHinsh commented 1 month ago

Would you be able to submit a PR with correction?

SamVanCutsem commented 1 month ago

I was busy creating the PR :-)