Skip to content

Commit 076d5a5

Browse files
committed
Optimize catalog generation and improve stability
1 parent 3b1a574 commit 076d5a5

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

spkrepo/views/nas.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ def get_catalog(arch, build, major, language, beta):
132132

133133
# Step 4: Construct response with "packages"
134134
packages = []
135-
for b in latest_build.all():
136-
packages.append(build_package_entry(b, language))
135+
for b in latest_build:
136+
packages.append(build_package_entry(b, language, arch, build))
137137

138138
# DSM 5.1
139139
if build >= 5004:
@@ -152,7 +152,7 @@ def get_catalog(arch, build, major, language, beta):
152152
return packages
153153

154154

155-
def build_package_entry(b, language):
155+
def build_package_entry(b, language, arch, build):
156156
entry = {
157157
"package": b.version.package.name,
158158
"version": b.version.version_string,
@@ -163,11 +163,7 @@ def build_package_entry(b, language):
163163
language, b.version.descriptions["enu"]
164164
).description,
165165
"link": url_for(
166-
".data",
167-
path=b.path,
168-
arch=b.architectures[0].code,
169-
build=b.firmware.build,
170-
_external=True,
166+
".data", path=b.path, arch=arch, build=build, _external=True,
171167
),
172168
"thumbnail": [
173169
url_for(".data", path=icon.path, _external=True)
@@ -247,7 +243,7 @@ def catalog():
247243
if build < 40000:
248244
beta = request.values.get("package_update_channel") == "beta"
249245
else:
250-
beta = False
246+
beta = False # Ensure no beta packages are returned for DSM 7+
251247
# Check if "major" is provided
252248
if "major" in request.values:
253249
try:

0 commit comments

Comments
 (0)