You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 905766f
Browse filesBrowse the repository at this point in the historyBrowse files
Benjamin Geer
authored
fix(api-v2): Don't check file extensions of XSL files and Gravsearch templates (DSP-1005) (#1749)
case _ =>throwInconsistentTriplestoreDataException(s"Resource $gravsearchTemplateIri is supposed to have exactly one value of type ${OntologyConstants.KnoraBase.TextFileValue}")
1344
1344
}
1345
1345
}
1346
1346
1347
1347
caseNone=>throwInconsistentTriplestoreDataException(s"Resource $gravsearchTemplateIri has no property ${OntologyConstants.KnoraBase.HasTextFileValue}")
1348
1348
}
1349
1349
1350
-
// check if `xsltFileValue` represents an XSL transformation
throwBadRequestException(s"Expected $fileValueIri to be a text file referring to a Gravsearch template, but it has MIME type ${gravsearchFileValueContent.fileValue.internalMimeType}")
case _ =>throwInconsistentTriplestoreDataException(s"${OntologyConstants.KnoraBase.XSLTransformation}$xslTransformationIri is supposed to have exactly one value of type ${OntologyConstants.KnoraBase.TextFileValue}")
181
181
}
182
182
}
183
183
184
184
caseNone=>throwInconsistentTriplestoreDataException(s"${OntologyConstants.KnoraBase.XSLTransformation} has no property ${OntologyConstants.KnoraBase.HasTextFileValue}")
185
185
}
186
186
187
-
// check if xsltFileValue represents an XSL transformation
throwBadRequestException(s"Expected $fileValueIri to be an XML file referring to an XSL transformation, but it has MIME type ${xsltFileValueContent.fileValue.internalMimeType}")
@@ -152,13 +152,17 @@ class SearchRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) wit
152
152
}
153
153
}
154
154
155
-
privatedeffullTextSearchCount(featureFactoryConfig: FeatureFactoryConfig):Route= path("v2"/"search"/"count"/Segment) { searchval=>// TODO: if a space is encoded as a "+", this is not converted back to a space
155
+
privatedeffullTextSearchCount(featureFactoryConfig: FeatureFactoryConfig):Route= path("v2"/"search"/"count"/Segment) { searchStr=>// TODO: if a space is encoded as a "+", this is not converted back to a space
if (searchStr.contains(OntologyConstants.KnoraApi.ApiOntologyHostname)) {
159
+
throwBadRequestException("It looks like you are submitting a Gravsearch request to a full-text search route")
160
+
}
159
161
160
-
if (searchString.length < settings.searchValueMinLength) {
161
-
throwBadRequestException(s"A search value is expected to have at least length of ${settings.searchValueMinLength}, but '$searchString' given of length ${searchString.length}.")
if (escapedSearchStr.length < settings.searchValueMinLength) {
165
+
throwBadRequestException(s"A search value is expected to have at least length of ${settings.searchValueMinLength}, but '$escapedSearchStr' given of length ${escapedSearchStr.length}.")
@@ -192,13 +196,17 @@ class SearchRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) wit
192
196
}
193
197
}
194
198
195
-
privatedeffullTextSearch(featureFactoryConfig: FeatureFactoryConfig):Route= path("v2"/"search"/Segment) { searchval=>// TODO: if a space is encoded as a "+", this is not converted back to a space
199
+
privatedeffullTextSearch(featureFactoryConfig: FeatureFactoryConfig):Route= path("v2"/"search"/Segment) { searchStr=>// TODO: if a space is encoded as a "+", this is not converted back to a space
if (searchStr.contains(OntologyConstants.KnoraApi.ApiOntologyHostname)) {
203
+
throwBadRequestException("It looks like you are submitting a Gravsearch request to a full-text search route")
204
+
}
199
205
200
-
if (searchString.length < settings.searchValueMinLength) {
201
-
throwBadRequestException(s"A search value is expected to have at least length of ${settings.searchValueMinLength}, but '$searchString' given of length ${searchString.length}.")
if (escapedSearchStr.length < settings.searchValueMinLength) {
209
+
throwBadRequestException(s"A search value is expected to have at least length of ${settings.searchValueMinLength}, but '$escapedSearchStr' given of length ${escapedSearchStr.length}.")
0 commit comments