Skip to content

Commit

Permalink
Sanitize feed name
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Oct 28, 2024
1 parent c20262f commit bf86adb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ name: Build

on:
push:
branches: [ master ]
branches:
- master
- v1
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:
branches: [ master ]
branches:
- master
- v1

jobs:
build:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Test

on:
push:
branches: [ master ]
branches:
- master
- v1
paths:
- '.github/workflows/test.yml'
- '**.py'
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cd
git clone https://github.com/FNNDSC/miniChRIS-docker.git
cd miniChRIS-docker
./minichris.sh
docker compose --profile hasura up -d
docker compose --profile pacs --profile hasura up -d
```

### Testing
Expand All @@ -57,6 +57,7 @@ First, run [miniChRIS-docker](https://github.com/FNNDSC/miniChRIS-docker) to get
then run pytest and _SERIE_ using Docker Compose:

```shell
docker compose --profile test build
docker compose run --use-aliases test
```

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
- ./src:/app:ro
ports:
- 8888:8000
environment:
CHRIS_URL: http://chris:8000/api/v1/
networks:
minichris-local:
aliases:
Expand Down
11 changes: 10 additions & 1 deletion src/serie/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,16 @@ def _expand_variables(template: str, series: DicomSeriesFilePair) -> str:
"""
Expand the value of variables in ``template`` using field values from ``series``.
"""
return template.format(**series.to_dict())
return _sanitize_feed_name(template.format(**series.to_dict()))


def _sanitize_feed_name(name: str) -> str:
"""
Sanitize the feed name to be allowed by CUBE's undocumented limitations.
"""
# slash not allowed. https://github.com/FNNDSC/ChRIS_ultron_backEnd/issues/523
sanitized = name.replace('/', '-')
return sanitized[:200] # truncate to 200 characters length


class InvalidRunnablesError(Exception):
Expand Down

0 comments on commit bf86adb

Please sign in to comment.