-
-
Notifications
You must be signed in to change notification settings - Fork 42
LT-22702: Escape custom list range ids at the point they are written #1064
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
Open
imnasnainaec
wants to merge
3
commits into
main
Choose a base branch
from
lift-ranges-custom-list-id-escaping
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+94
−6
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,8 +56,14 @@ public class LiftExporter | |
| private readonly int m_wsBestVernAnal; | ||
| /// <summary> | ||
| /// This contains the possibility lists that are custom or that are referenced by a custom field. | ||
| /// Range names are held unescaped, so that each is escaped by the rules of the context it is | ||
| /// written into. | ||
| /// </summary> | ||
| private Dictionary<Guid, string> m_CmPossListsReferencedOrCustom = new Dictionary<Guid, string>(); | ||
| /// <summary> | ||
| /// Maps a possibility list to the name of its LIFT range. Range names are held unescaped, so | ||
| /// that each is escaped by the rules of the context it is written into. | ||
| /// </summary> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we need this comment. The field name is self-documenting, and the usage is documented by example. |
||
| private Dictionary<Guid, string> m_ListsGuidToRangeName = new Dictionary<Guid, string>(); | ||
| private readonly ICmPossibilityListRepository m_repoCmPossibilityLists; | ||
| private readonly ISilDataAccessManaged m_sda; | ||
|
|
@@ -1979,10 +1985,11 @@ private void WritePossibilityListAsRange(TextWriter w, string rangeId, ICmPossib | |
| { | ||
| if (list.PossibilitiesOS.Count == 0) | ||
| return; | ||
| var sRangeId = MakeSafeAndNormalizedAttribute(rangeId); | ||
| if (String.IsNullOrEmpty(guid)) //only output the guid for custom lists | ||
| w.WriteLine("<range id=\"{0}\">", rangeId); | ||
| w.WriteLine("<range id=\"{0}\">", sRangeId); | ||
| else | ||
| w.WriteLine("<range id=\"{0}\" guid=\"{1}\">", rangeId, MakeSafeAndNormalizedAttribute(guid)); | ||
| w.WriteLine("<range id=\"{0}\" guid=\"{1}\">", sRangeId, MakeSafeAndNormalizedAttribute(guid)); | ||
| foreach (var poss in list.ReallyReallyAllPossibilities) | ||
| { | ||
| var liftId = poss.Name.BestAnalysisVernacularAlternative.Text; | ||
|
|
@@ -2348,7 +2355,7 @@ private Dictionary<Guid, string> GetCustomListsAndReferencedLists(IEnumerable<IL | |
| { | ||
| var rangeName = RangeNames.GetRangeNameForLiftExport(m_mdc, possList); | ||
| if (!listsToBeExported.ContainsKey(possList.Guid)) | ||
| listsToBeExported.Add(possList.Guid, MakeSafeAndNormalizedXml(rangeName)); | ||
| listsToBeExported.Add(possList.Guid, rangeName); | ||
| } | ||
| break; | ||
| default: | ||
|
|
@@ -2367,7 +2374,7 @@ private void GetCustomListsNotYetAdded(ICmPossibilityListRepository possListRepo | |
| if (list.Owner == null && !listsToBeExported.ContainsKey(list.Guid)) | ||
| { | ||
| var rangeName = RangeNames.GetRangeNameForLiftExport(m_mdc, list); | ||
| listsToBeExported[list.Guid] = MakeSafeAndNormalizedXml(rangeName); | ||
| listsToBeExported[list.Guid] = rangeName; | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -2440,7 +2447,7 @@ private void AddPossListRefdByField(int possHvo, Dictionary<Guid, string> cmPoss | |
| var rangeName = RangeNames.GetRangeNameForLiftExport(m_mdc, possList); | ||
| if (!cmPossibilityListsReferencedByFields.ContainsKey(possListGuid)) | ||
| { | ||
| cmPossibilityListsReferencedByFields.Add(possListGuid, MakeSafeAndNormalizedXml(rangeName)); | ||
| cmPossibilityListsReferencedByFields.Add(possListGuid, rangeName); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -2463,7 +2470,7 @@ private void MapCmPossibilityListGuidsToLiftRangeNames(Dictionary<Guid, string> | |
| //by a custom field and which are not already included yet. | ||
| foreach (var list in cmPossibilityListsReferencedByFields) | ||
| { | ||
| m_ListsGuidToRangeName.Add(list.Key, MakeSafeAndNormalizedXml(list.Value)); | ||
| m_ListsGuidToRangeName.Add(list.Key, list.Value); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this comment go at the beginning of this method?