Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit 0068593

Browse files
committed
literal design flaw
1 parent e0df557 commit 0068593

File tree

5 files changed

+19
-15
lines changed

5 files changed

+19
-15
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "api"
3-
version = "2.3.0"
3+
version = "2.3.1"
44
edition = "2024"
55

66
[profile.dev]

src/models/extension.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ impl Extension {
161161
FROM extensions
162162
JOIN authors ON extensions.author_id = authors.id
163163
WHERE
164-
identifier = $1
165-
AND NOT pending
166-
AND NOT hidden
164+
extensions.identifier = $1
165+
AND NOT extensions.pending
166+
AND NOT extensions.hidden
167167
"#,
168168
Self::columns_sql(None, None)
169169
))
@@ -182,9 +182,9 @@ impl Extension {
182182
FROM extensions
183183
JOIN authors ON extensions.author_id = authors.id
184184
WHERE
185-
id = $1
186-
AND NOT pending
187-
AND NOT hidden
185+
extensions.id = $1
186+
AND NOT extensions.pending
187+
AND NOT extensions.hidden
188188
"#,
189189
Self::columns_sql(None, None)
190190
))

src/models/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ pub mod extension;
77

88
pub trait BaseModel: Serialize + DeserializeOwned {
99
fn columns(prefix: Option<&str>, table: Option<&str>) -> BTreeMap<String, String>;
10+
11+
#[inline]
1012
fn columns_sql(prefix: Option<&str>, table: Option<&str>) -> String {
1113
Self::columns(prefix, table)
1214
.iter()

src/telemetry.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ impl TelemetryLogger {
131131
}
132132

133133
#[inline]
134-
async fn lookup_ips(&self, ips: &[&str]) -> HashMap<String, [String; 2]> {
134+
async fn lookup_ips(
135+
&self,
136+
ips: &[&str],
137+
) -> Result<HashMap<String, [String; 2]>, reqwest::Error> {
135138
let mut result = HashMap::new();
136139

137140
let data = self
@@ -149,11 +152,9 @@ impl TelemetryLogger {
149152
.collect::<HashSet<_>>(),
150153
)
151154
.send()
152-
.await
153-
.unwrap()
155+
.await?
154156
.json::<Vec<serde_json::Value>>()
155-
.await
156-
.unwrap();
157+
.await?;
157158

158159
for entry in data {
159160
if entry.get("continentCode").is_none() || entry.get("countryCode").is_none() {
@@ -169,7 +170,7 @@ impl TelemetryLogger {
169170
);
170171
}
171172

172-
result
173+
Ok(result)
173174
}
174175

175176
pub async fn process(&self) {
@@ -192,7 +193,8 @@ impl TelemetryLogger {
192193
.collect::<Vec<_>>()
193194
.as_slice(),
194195
)
195-
.await;
196+
.await
197+
.unwrap_or_default();
196198

197199
for t in telemetry.iter_mut() {
198200
if let Some([continent, country]) = ips.get(&t.ip) {

0 commit comments

Comments
 (0)