Skip to content

Commit e1c3380

Browse files
committed
Fixed issue with incorrect UDI type
The UDI type for content is actually "document", so when using "content" instead, more than one relation may be added with the same key or ID 🤦‍♂️
1 parent 848ec14 commit e1c3380

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Skybrud.LinkPicker/Factories/LinkReferenceFactory.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal class LinkReferenceFactory : IDataValueReferenceFactory, IDataValueRefe
1212
public IDataValueReference GetDataValueReference() => this;
1313

1414
public IEnumerable<UmbracoEntityReference> GetReferences(object value) {
15-
15+
1616
List<UmbracoEntityReference> references = new List<UmbracoEntityReference>();
1717
if (value is not string json) return references;
1818

@@ -22,15 +22,16 @@ public IEnumerable<UmbracoEntityReference> GetReferences(object value) {
2222
switch (link.Type) {
2323

2424
case LinkPickerType.Content:
25-
references.Add(new UmbracoEntityReference(new GuidUdi("content", link.Key)));
25+
26+
references.Add(new UmbracoEntityReference(new GuidUdi(Constants.UdiEntityType.Document, link.Key)));
2627
break;
2728

2829
case LinkPickerType.Media:
29-
references.Add(new UmbracoEntityReference(new GuidUdi("media", link.Key)));
30+
references.Add(new UmbracoEntityReference(new GuidUdi(Constants.UdiEntityType.Media, link.Key)));
3031
break;
31-
32+
3233
}
33-
34+
3435
return references;
3536

3637
}

0 commit comments

Comments
 (0)