Fix issue where url would sometimes contain multiple slashes
parent
864523392e
commit
3a01b0db69
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "szuru-chrome",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"description": "Import media from various sites into szurubooru",
|
||||
"author": "neobooru",
|
||||
"license": "MIT",
|
||||
|
|
|
|||
|
|
@ -22,3 +22,11 @@ export class Message {
|
|||
this.category = category ?? "none";
|
||||
}
|
||||
}
|
||||
|
||||
export function getUrl(root: string, ...parts: string[]): string {
|
||||
let url = root.replace(/\/+$/, "");
|
||||
for (const part of parts) {
|
||||
url += "/" + part.replace(/\/+$/, "");
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export class Config {
|
|||
|
||||
public async save() {
|
||||
await browser.storage.local.set({
|
||||
"config": JSON.stringify(this)
|
||||
config: JSON.stringify(this)
|
||||
});
|
||||
|
||||
console.dir("Save " + JSON.stringify(this));
|
||||
|
|
@ -34,4 +34,3 @@ export class Config {
|
|||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ import { ScrapedPost, ScrapedTag, ScrapeResults } from "neo-scraper";
|
|||
import SzuruWrapper from "../SzuruWrapper";
|
||||
import { Post, SzuruError } from "../SzuruTypes";
|
||||
import { Config, SzuruSiteConfig } from "../Config";
|
||||
import { BrowserCommand, Message } from "../Common";
|
||||
import { BrowserCommand, Message, getUrl } from "../Common";
|
||||
|
||||
class ScrapedPostViewModel extends ScrapedPost {
|
||||
name: string = "";
|
||||
|
|
@ -247,7 +247,7 @@ export default Vue.extend({
|
|||
},
|
||||
getPostUrl(post: Post): string {
|
||||
if (!this.activeSite) return "";
|
||||
return this.activeSite.domain + "/post/" + post.id;
|
||||
return getUrl(this.activeSite.domain, "post", post.id.toString());
|
||||
},
|
||||
// Add tag to the post's taglist
|
||||
addTag() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue