Skip to content

Commit 82080c8

Browse files
committed
修正
1 parent a643300 commit 82080c8

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

feline/src/api_permlink.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ pub async fn get_api_permlink(
1414
State(config): State<Arc<AppConfig>>,
1515
Path(permlink_id): Path<String>,
1616
) -> Result<Json<GetPermlinkResponse>, AppError> {
17-
let permlink: GetPermlinkResponse =
18-
get_permlink(&config.sqlite.clone().unwrap(), &permlink_id).await?;
17+
let permlink: GetPermlinkResponse = get_permlink(
18+
&config.sqlite.clone().unwrap(),
19+
&permlink_id,
20+
&config.wandbox_url,
21+
)
22+
.await?;
1923
return Ok(Json(permlink));
2024
}
2125

feline/src/db.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ pub async fn make_permlink(
100100
pub async fn get_permlink(
101101
pool: &SqlitePool,
102102
permlink_name: &str,
103+
wandbox_url: &str,
103104
) -> Result<GetPermlinkResponse, anyhow::Error> {
104105
let mut tx: sqlx::Transaction<'_, Sqlite> = pool.begin().await?;
105106

@@ -212,7 +213,7 @@ pub async fn get_permlink(
212213
// CompileResult を計算する
213214
let mut result: CompileResult = merge_compile_result(&results);
214215
result.permlink = permlink_name.to_string();
215-
result.url = format!("https://wandbox.org/permlink/{}", permlink_name);
216+
result.url = format!("{}permlink/{}", wandbox_url, permlink_name);
216217

217218
Ok(GetPermlinkResponse {
218219
parameter,
@@ -376,7 +377,7 @@ mod tests {
376377
assert!(result.is_ok());
377378

378379
let response: Result<GetPermlinkResponse, anyhow::Error> =
379-
get_permlink(&pool, &permlink_name).await;
380+
get_permlink(&pool, &permlink_name, "https://wandbox.org/").await;
380381
assert!(response.is_ok(), "get_permlink failed: {:?}", response);
381382

382383
let response: GetPermlinkResponse = response.unwrap();

feline/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ pub struct CompileParameter {
246246
pub created_at: i64,
247247
#[serde(default)]
248248
pub is_private: bool,
249-
#[serde(default)]
249+
#[serde(rename = "compiler-info", default)]
250250
pub compiler_info: CompilerInfo,
251251
}
252252

0 commit comments

Comments
 (0)