File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -57,12 +57,6 @@ const MetadataStateProvider = ({
5757 if ( isNone ( key ) && isNone ( value ) && Object . keys ( state ) . length == 1 ) {
5858 return acc ;
5959 }
60- // This means that we have more than one metadata items with the same key
61- if ( Object . keys ( acc ) . includes ( key as string ) ) {
62- let error : any | Error = new Error ( "Metadata keys must be unique." ) ;
63- error . key = key ;
64- throw error ;
65- }
6660 // This means that the metadata item has undefined key and/or value
6761 if ( isNoneOrEmpty ( key ) || isNoneOrEmpty ( value ) ) {
6862 let error : any | Error = new Error (
@@ -71,7 +65,14 @@ const MetadataStateProvider = ({
7165 error . key = key ;
7266 throw error ;
7367 }
74- return { ...acc , [ key as string ] : value } ;
68+ // Convert key to string and check for uniqueness
69+ const stringKey = String ( key ) ;
70+ if ( Object . keys ( acc ) . includes ( stringKey ) ) {
71+ let error : any | Error = new Error ( "Metadata keys must be unique." ) ;
72+ error . key = key ;
73+ throw error ;
74+ }
75+ return { ...acc , [ stringKey ] : value } ;
7576 } , { } ) ;
7677 let discarded_keys = Object . keys ( value || { } ) . filter (
7778 ( key ) => ! Object . keys ( added_values ) . includes ( key ) ,
Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ export const MetadataEditor = ({
8080 < div className = "column p-1" >
8181 { ! isEditing && (
8282 < >
83- { value ?. includes ( "http://" ) ||
84- value ? .includes ( "https://" ) ? (
83+ { typeof value === "string" &&
84+ ( value . includes ( "http://" ) || value . includes ( " https://") ) ? (
8585 < a
8686 href = { value }
8787 target = "_blank"
You can’t perform that action at this time.
0 commit comments