Skip to content

Commit b645862

Browse files
committed
Merge branch 'release/26.1.0'
2 parents 9ca887b + 309fb4e commit b645862

4 files changed

Lines changed: 22 additions & 5 deletions

File tree

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
ChangeLog
33
*********
44

5+
26.1.0 (2026-04-28)
6+
===================
7+
- Rewrite legacy OSF file urls to point to downloadable url.
8+
59
26.0.1 (2026-04-06)
610
===================
711
- Bump newerlic dep to work with celery.

mfr/providers/osf/provider.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import re
23
import json
34
import hashlib
45
import logging
@@ -172,11 +173,23 @@ async def _fetch_download_url(self):
172173
self.download_url = self.url
173174
self.metrics.add('download_url.orig_type', 'wb_v1')
174175
else:
175-
self.metrics.add('download_url.orig_type', 'osf')
176+
normalized_url = None
177+
if re.compile(r'^/[a-z0-9]{5}/[^/]*', re.IGNORECASE).match(path):
178+
# In the past the OSF would redirect urls of the form https://osf.io/<file_guid>/ to
179+
# https://osf.io/download/<file_guid>/. It no longer does this, so MFR must detect
180+
# such urls and manually prepend /download/ to the path.
181+
self.metrics.add('download_url.orig_type', 'osf-preangular')
182+
temp_url = furl.furl(self.url)
183+
temp_url.path.segments = ['download'] + temp_url.path.segments
184+
normalized_url = temp_url.url
185+
else:
186+
self.metrics.add('download_url.orig_type', 'osf')
187+
normalized_url = self.url
188+
176189
# make request to osf, don't follow, store waterbutler download url
177190
request = await self._make_request(
178191
'GET',
179-
self.url,
192+
normalized_url,
180193
allow_redirects=False,
181194
headers={
182195
'Content-Type': 'application/json'
@@ -188,7 +201,7 @@ async def _fetch_download_url(self):
188201
if request.status != 302:
189202
raise exceptions.MetadataError(
190203
request.reason,
191-
metadata_url=self.url,
204+
metadata_url=normalized_url,
192205
provider=self.NAME,
193206
code=request.status,
194207
)

mfr/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '26.0.1'
1+
__version__ = '26.1.0'

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "mfr"
3-
version = "26.0.1"
3+
version = "26.1.0"
44
description = "Modular File Renderer"
55
authors = ["Center for Open Science <contact@cos.io>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)