Skip to content

Commit

Permalink
Merge pull request #253 from oarepo/stojanovic/fe-281-stripping-of-ri…
Browse files Browse the repository at this point in the history
…ch-text-react

added allowed html tags to search config
  • Loading branch information
mirekys authored Nov 13, 2024
2 parents e954b6d + 70c3b25 commit 3665318
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
26 changes: 15 additions & 11 deletions oarepo_ui/resources/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def form_config(self):
self.run_components(
"form_config",
form_config=form_config,
args = resource_requestctx.args,
args=resource_requestctx.args,
view_args=resource_requestctx.view_args,
identity=g.identity,
)
Expand Down Expand Up @@ -167,7 +167,7 @@ def create_url_rules(self):
routes = []
route_config = self.config.routes
for route_name, route_url in route_config.items():
route_url = self.config.url_prefix.rstrip('/') + "/" + route_url.lstrip('/')
route_url = self.config.url_prefix.rstrip("/") + "/" + route_url.lstrip("/")
if route_name == "search":
search_route = route_url
if not search_route.endswith("/"):
Expand All @@ -187,14 +187,14 @@ def create_url_rules(self):
for route_name, route_url in self.config.config_routes.items():
if route_url:
route_url = "{config_prefix}/{url_prefix}/{route}".format(
config_prefix=self.config.config_url_prefix.rstrip('/'),
url_prefix=self.config.url_prefix.strip('/'),
route=route_url.lstrip('/')
config_prefix=self.config.config_url_prefix.rstrip("/"),
url_prefix=self.config.url_prefix.strip("/"),
route=route_url.lstrip("/"),
)
else:
route_url = "{config_prefix}/{url_prefix}".format(
config_prefix=self.config.config_url_prefix.rstrip('/'),
url_prefix=self.config.url_prefix.strip('/')
config_prefix=self.config.config_url_prefix.rstrip("/"),
url_prefix=self.config.url_prefix.strip("/"),
)

routes.append(route("GET", route_url, getattr(self, route_name)))
Expand Down Expand Up @@ -318,9 +318,13 @@ def file_preview(self, *args, is_preview=False, **kwargs):

# TODO: this is a hack that should be fixed
try:
record = self._get_record(resource_requestctx, allow_draft=is_preview)._record
record = self._get_record(
resource_requestctx, allow_draft=is_preview
)._record
except Forbidden:
record = self._get_record(resource_requestctx, allow_draft=not is_preview)._record
record = self._get_record(
resource_requestctx, allow_draft=not is_preview
)._record

file_service = get_file_service_for_record_class(type(record))
file_metadata = file_service.read_file_metadata(g.identity, pid_value, filepath)
Expand Down Expand Up @@ -409,6 +413,7 @@ def search(self):
"ui_links": ui_links,
"overridableIdPrefix": overridable_id_prefix,
"defaultComponents": default_components,
"allowedHtmlTags": ["sup", "sub", "em", "strong"],
},
)

Expand Down Expand Up @@ -714,7 +719,6 @@ def permission_denied(self, error, *args, **kwargs):
error=error,
)


@request_form_config_view_args
def form_config(self):
form_config = self._get_form_config(identity=g.identity)
Expand All @@ -726,7 +730,7 @@ def form_config(self):
data=None,
ui_links=None,
extra_context=None,
args = resource_requestctx.args,
args=resource_requestctx.args,
view_args=resource_requestctx.view_args,
identity=g.identity,
)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = oarepo-ui
version = 5.2.23
version = 5.2.24
description = UI module for invenio 3.5+
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down

0 comments on commit 3665318

Please sign in to comment.