Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Don't sanitize username in ingestion #44

Merged
merged 2 commits into from May 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions lega/ingest.py
Expand Up @@ -11,7 +11,7 @@
When a message is consumed, it must at least contain the following fields:

* ``filepath``
* ``user_id``
* ``user``

Upon completion, a message is sent to the local exchange with the
routing key :``archived``.
Expand All @@ -26,7 +26,7 @@
from crypt4gh import header

from .conf import CONF
from .utils import db, exceptions, errors, sanitize_user_id, storage
from .utils import db, exceptions, errors, storage
from .utils.amqp import consume

LOG = logging.getLogger(__name__)
Expand All @@ -51,15 +51,15 @@ def work(fs, inbox_fs, data):
LOG.info('Processing %s', filepath)

# Remove the host part of the user name
user_id = sanitize_user_id(data['user'])
user = data['user']

# Keeping data as-is (cuz the decorator is using it)
# It will be augmented, but we keep the original data first
org_msg = data.copy()
data['org_msg'] = org_msg

# Insert in database
file_id = db.insert_file(filepath, user_id)
file_id = db.insert_file(filepath, user)

data['file_id'] = file_id # must be there: database error uses it

Expand All @@ -70,7 +70,7 @@ def work(fs, inbox_fs, data):
file_checksum = [item for item in data['encrypted_checksums'] if item.get('type') == 'sha256']

# Instantiate the inbox backend
inbox = inbox_fs(user_id)
inbox = inbox_fs(user)
LOG.info("Inbox backend: %s", str(inbox))

# Check if file is in inbox
Expand Down