Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CleanRepo] remove-hops doesn't handle monikers in redirect file #349

Open
Mikejo5000 opened this issue May 13, 2024 · 7 comments
Open

[CleanRepo] remove-hops doesn't handle monikers in redirect file #349

Mikejo5000 opened this issue May 13, 2024 · 7 comments
Assignees

Comments

@Mikejo5000
Copy link

Mikejo5000 commented May 13, 2024

CleanRepo doesn't handle monikered redirects well. The following causes a "same key" error when there's another redirect with the same source_path but a different moniker value (vs-2022):

{
"source_path": "docs/install/visual-studio-build-numbers-and-release-dates.md",
"redirect_url": "/visualstudio/releases/2019/history#release-dates-and-build-numbers",
"redirect_document_id": false,
"monikers": [
"vs-2019"
]
}
@Mikejo5000 Mikejo5000 changed the title [CleanRepo] remove-hops command appears to expect a certain directory structure [CleanRepo] remove-hops command results in an error May 13, 2024
@gewarren
Copy link
Contributor

@Mikejo5000 This is happening because you have two redirects for the same file:

  1. https://github.com/MicrosoftDocs/visualstudio-docs-pr/blob/f6dc881f5b4fa8a7300d27cefaa0a6d53303b5ba/.openpublishing.redirection.vs2017.json#L39585
  2. https://github.com/MicrosoftDocs/visualstudio-docs-pr/blob/f6dc881f5b4fa8a7300d27cefaa0a6d53303b5ba/.openpublishing.redirection.vs2017.json#L42686

One could argue that CleanRepo should handle it better though, so I'll leave this issue open. But you could remove one of those redirects for now and then rerun the tool.

@Mikejo5000
Copy link
Author

@gewarren Great, thanks! I'll try it out

@Mikejo5000
Copy link
Author

@gewarren Genevieve, do you know what this error means? I don't see anything wrong with line 905 in the redirection file.

Removing hops from the '.openpublishing.redirection.json' redirection file.
Caught exception while reading the C:\git-repos\visualstudio-docs-pr.openpublishing.redirection.json file: The JSON value could not be converted to System.Nullable`1[System.Boolean]. Path: $.redirections[180].redirect_document_id | LineNumber: 905 | BytePositionInLine: 37. Cannot get the value of a token type 'String' as a boolean.
Deserialization of redirection file failed.

@gewarren
Copy link
Contributor

gewarren commented Aug 1, 2024

@Mikejo5000 Probably means you have true or false in quotes. Should look like this instead: https://github.com/dotnet/docs/blob/b74766942f2d9c52375d29c515be9fdcaced4d4b/.openpublishing.redirection.csharp.json#L230

@Mikejo5000
Copy link
Author

Yes, that looks right. Thanks!

@Mikejo5000
Copy link
Author

It appears that the tool is not handling monikered redirects well. The following causes a "same key" error when there's another redirect with the same source_path but a different moniker value (vs-2022):
{
"source_path": "docs/install/visual-studio-build-numbers-and-release-dates.md",
"redirect_url": "/visualstudio/releases/2019/history#release-dates-and-build-numbers",
"redirect_document_id": false,
"monikers": [
"vs-2019"
]
},

@gewarren
Copy link
Contributor

gewarren commented Aug 1, 2024

@Mikejo5000 Okay, thank you. Let's track that with this issue. I'll update the title.

@gewarren gewarren changed the title [CleanRepo] remove-hops command results in an error [CleanRepo] remove-hops doesn't handle monikers in redirect file Aug 1, 2024
@gewarren gewarren self-assigned this Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants