Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: remove {filetype} in path template (#1377)

Zeng19987529296dd54d
diff --git a/server/resource.go b/server/resource.go
index a463ac595..f638bc940 100644
--- a/server/resource.go
+++ b/server/resource.go
@@ -147,8 +147,6 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
switch s {
case "{filename}":
return filename
- case "{filetype}":
- return filetype
case "{timestamp}":
return fmt.Sprintf("%d", t.Unix())
case "{year}":
diff --git a/store/idp.go b/store/idp.go
index 72b0ca3d8..9958757bc 100644
--- a/store/idp.go
+++ b/store/idp.go
@@ -289,6 +289,8 @@ func listIdentityProviders(ctx context.Context, tx *sql.Tx, find *FindIdentityPr
}
identityProviderMessages = append(identityProviderMessages, &identityProviderMessage)
}
-
+ if err := rows.Err(); err != nil {
+ return nil, FormatError(err)
+ }
return identityProviderMessages, nil
}
diff --git a/web/src/components/CreateStorageServiceDialog.tsx b/web/src/components/CreateStorageServiceDialog.tsx
index 6cae33770..72f99828b 100644
--- a/web/src/components/CreateStorageServiceDialog.tsx
+++ b/web/src/components/CreateStorageServiceDialog.tsx
@@ -4,6 +4,7 @@ import { Button, Input, Typography } from "@mui/joy";
import * as api from "../helpers/api";
import { generateDialog } from "./Dialog";
import Icon from "./Icon";
+import RequiredBadge from "./RequiredBadge";
interface Props extends DialogProps {
storage?: ObjectStorage;
@@ -48,7 +49,13 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
return false;
}
if (type === "S3") {
- if (s3Config.endPoint === "" || s3Config.region === "" || s3Config.accessKey === "" || s3Config.bucket === "") {
+ if (
+ s3Config.endPoint === "" ||
+ s3Config.region === "" ||
+ s3Config.accessKey === "" ||
+ s3Config.secretKey === "" ||
+ s3Config.bucket === ""
+ ) {
return false;
}
}
@@ -113,6 +120,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
<div className="dialog-content-container">
<Typography className="!mb-1" level="body2">
Name
+ <RequiredBadge />
</Typography>
<Input
className="mb-2"
@@ -128,6 +136,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
/>
<Typography className="!mb-1" level="body2">
EndPoint
+ <RequiredBadge />
<span className="text-sm text-gray-400 ml-1">(S3-compatible server URL)</span>
</Typography>
<Input
@@ -139,6 +148,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
/>
<Typography className="!mb-1" level="body2">
Region
+ <RequiredBadge />
<span className="text-sm text-gray-400 ml-1">(Region name)</span>
</Typography>
<Input
@@ -150,6 +160,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
/>
<Typography className="!mb-1" level="body2">
AccessKey
+ <RequiredBadge />
<span className="text-sm text-gray-400 ml-1">(Access Key / Access ID)</span>
</Typography>
<Input
@@ -161,6 +172,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
/>
<Typography className="!mb-1" level="body2">
SecretKey
+ <RequiredBadge />
<span className="text-sm text-gray-400 ml-1">(Secret Key / Secret Access Key)</span>
</Typography>
<Input
@@ -172,6 +184,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
/>
<Typography className="!mb-1" level="body2">
Bucket
+ <RequiredBadge />
<span className="text-sm text-gray-400 ml-1">(Bucket name)</span>
</Typography>
<Input
@@ -187,8 +200,8 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
</Typography>
<Typography className="!mb-1" level="body2">
<p className="text-sm text-gray-400 ml-1">{"You can use {year}, {month}, {day}, {hour}, {minute}, {second},"}</p>
- <p className="text-sm text-gray-400 ml-1">{"{filetype}, {filename}, {timestamp} and any other words."}</p>
- <p className="text-sm text-gray-400 ml-1">{"e.g., {year}/{month}/{day}/your/path/{filename}.{filetype}"}</p>
+ <p className="text-sm text-gray-400 ml-1">{"{filename}, {timestamp} and any other words."}</p>
+ <p className="text-sm text-gray-400 ml-1">{"e.g., {year}/{month}/{day}/your/path/{filename}"}</p>
</Typography>
<Input
className="mb-2"
diff --git a/web/src/components/RequiredBadge.tsx b/web/src/components/RequiredBadge.tsx
new file mode 100644
index 000000000..879533856
--- /dev/null
+++ b/web/src/components/RequiredBadge.tsx
@@ -0,0 +1,11 @@
+interface Props {
+ className?: string;
+}
+
+const RequiredBadge: React.FC<Props> = (props: Props) => {
+ const { className } = props;
+
+ return <span className={`mx-0.5 text-red-500 font-bold ${className ?? ""}`}>*</span>;
+};
+
+export default RequiredBadge;