diff --git a/src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx b/src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx
index 085f9aa10d6..ea7a3fc485c 100644
--- a/src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx
+++ b/src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx
@@ -46,12 +46,12 @@ const copyFile = async () => {
try {
const response = await copy({
source: {
- path: 'album/2024/1.jpg',
- // Alternatively, path: ({identityId}) => `album/{identityId}/1.jpg`
+ path: `album/2024/${encodeURIComponent('#1.jpg')}`,
+ // Alternatively, path: ({identityId}) => `album/${identityId}/${encodeURIComponent('#1.jpg')`
},
destination: {
- path: 'shared/2024/1.jpg',
- // Alternatively, path: ({identityId}) => `shared/{identityId}/1.jpg`
+ path: 'shared/2024/#1.jpg',
+ // Alternatively, path: ({identityId}) => `shared/${identityId}/#1.jpg`
},
});
} catch (error) {
@@ -59,6 +59,12 @@ const copyFile = async () => {
}
};
```
+
+
+The operation can fail if there's a special character in the `source` path. You should URI encode the source
+path with special character. You **don't** need to encode the `destination` path.
+
+
@@ -106,7 +112,7 @@ In order to copy to or from a bucket other than your default, both source and de
Option | Type | Default | Description |
| -- | :--: | :--: | ----------- |
-| path | string \|
(\{ identityId \}) => string | Required | A string or callback that represents the path in source and destination bucket to copy the object to or from |
+| path | string \|
(\{ identityId \}) => string | Required | A string or callback that represents the path in source and destination bucket to copy the object to or from.
**Each segment of the path in `source` must by URI encoded.** |
| bucket | string \|
\{ bucketName: string;
region: string; \} | Default bucket and region from Amplify configuration | A string representing the target bucket's assigned name in Amplify Backend or an object specifying the bucket name and region from the console.
Read more at [Configure additional storage buckets](/[platform]/build-a-backend/storage/set-up-storage/#configure-additional-storage-buckets). |