Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def upload(self, item):
href = utils.generate_href(item.ident) + self.fileext
return self._put(href, item, None)
def _get_href(self, ident):
return generate_href(ident) + self.fileext
def _get_href(self, item):
href = utils.generate_href(item.ident)
return self._normalize_href(href + self.fileext)
def _get_href(self, item):
href = utils.generate_href(item.ident)
return self._normalize_href(href + self.fileext)
def repair_item(href, item, seen_uids, repair_unsafe_uid):
if item.parsed is None:
raise IrreparableItem()
new_item = item
if not item.uid:
logger.warning('No UID, assigning random UID.')
new_item = item.with_uid(generate_href())
elif item.uid in seen_uids:
logger.warning('Duplicate UID, assigning random UID.')
new_item = item.with_uid(generate_href())
elif not href_safe(item.uid) or not href_safe(basename(href)):
if not repair_unsafe_uid:
logger.warning('UID may cause problems, add '
'--repair-unsafe-uid to repair.')
else:
logger.warning('UID or href is unsafe, assigning random UID.')
new_item = item.with_uid(generate_href())
if not new_item.uid:
raise IrreparableItem()
return new_item