Skip to content

Commit 0220963

Browse files
author
Gabriel Garcia
committed
fix: quote content type profile value
(cherry picked from commit eb54d5d)
1 parent 1a4dbf1 commit 0220963

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/MakingSense.AspNetCore.HypermediaApi/Metadata/ActionRelationAttribute.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,11 @@ public void OnResultExecuting([NotNull]ResultExecutingContext context)
9898
}
9999
}
100100

101-
private static void AddProfileToContentType(ResultExecutingContext context, SchemaAttribute schemaAttribute)
101+
private static void AddProfileToContentType(ResultExecutingContext context, SchemaAttribute schemaAttribute, bool keepUnquoted = false)
102102
{
103-
context.HttpContext.Response.ContentType += $"; profile={schemaAttribute.SchemaFilePath}";
103+
var profile = keepUnquoted ? schemaAttribute.SchemaFilePath
104+
: $"\"{schemaAttribute.SchemaFilePath?.Replace("\"", "\\\"")}\"";
105+
context.HttpContext.Response.ContentType += $"; profile={profile}";
104106
}
105107

106108
private SchemaAttribute GetSchemaAttributeFromOutputModel()

0 commit comments

Comments
 (0)