Skip to content

Commit fba1e46

Browse files
authored
Quickfix: Anticipate that crawl profile may have been deleted (#3036)
Regression fix for issue discovered during testing of the upcoming 1.20 release which resulted in the GET `/all-crawls` endpoint returning a 404 if a profile that any crawl references no longer exists (which we should anticipate and allow).
1 parent 8ba4331 commit fba1e46

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

backend/btrixcloud/basecrawls.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,14 @@ async def _resolve_crawl_refs(
464464
raise HTTPException(status_code=400, detail="missing_org")
465465

466466
if hasattr(crawl, "profileid") and crawl.profileid:
467-
profile = await self.crawl_configs.profiles.get_profile(
468-
crawl.profileid, org
469-
)
470-
if profile:
467+
try:
468+
profile = await self.crawl_configs.profiles.get_profile(
469+
crawl.profileid, org
470+
)
471471
crawl.profileName = profile.name
472+
# pylint: disable=bare-except
473+
except:
474+
crawl.profileName = ""
472475

473476
if (
474477
files

backend/btrixcloud/crawlconfigs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,9 +1044,8 @@ async def get_crawl_config_out(self, cid: UUID, org: Organization):
10441044

10451045
if crawlconfig.profileid:
10461046
profile = await self.profiles.get_profile(crawlconfig.profileid, org)
1047-
if profile:
1048-
crawlconfig.profileName = profile.name
1049-
crawlconfig.proxyId = profile.proxyId
1047+
crawlconfig.profileName = profile.name
1048+
crawlconfig.proxyId = profile.proxyId
10501049

10511050
crawlconfig.config.seeds = None
10521051

0 commit comments

Comments
 (0)