mirror of
https://github.com/Qortal/qapp-core.git
synced 2025-06-15 09:51:21 +00:00
fix name and identifier parsing
This commit is contained in:
parent
4ea8ee87e3
commit
9eb467ad72
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "qapp-core",
|
"name": "qapp-core",
|
||||||
"version": "1.0.10",
|
"version": "1.0.11",
|
||||||
"description": "Qortal's core React library with global state, UI components, and utilities",
|
"description": "Qortal's core React library with global state, UI components, and utilities",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/index.mjs",
|
"module": "dist/index.mjs",
|
||||||
|
@ -28,7 +28,7 @@ export const usePublish = (
|
|||||||
|
|
||||||
const [hasResource, setHasResource] = useState<boolean | null>(null);
|
const [hasResource, setHasResource] = useState<boolean | null>(null);
|
||||||
const fetchRawData = useCallback(async (item: QortalGetMetadata) => {
|
const fetchRawData = useCallback(async (item: QortalGetMetadata) => {
|
||||||
const url = `/arbitrary/${item?.service}/${item?.name}/${item?.identifier}?encoding=base64`;
|
const url = `/arbitrary/${item?.service}/${encodeURIComponent(item?.name)}/${encodeURIComponent(item?.identifier)}?encoding=base64`;
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
const data = await res.text();
|
const data = await res.text();
|
||||||
if(returnType === 'BASE64'){
|
if(returnType === 'BASE64'){
|
||||||
@ -104,7 +104,7 @@ export const usePublish = (
|
|||||||
resourceExists: true
|
resourceExists: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const url = `/arbitrary/resources/search?mode=ALL&service=${metadataProp?.service}&limit=1&includemetadata=true&reverse=true&excludeblocked=true&name=${metadataProp?.name}&exactmatchnames=true&offset=0&identifier=${metadataProp?.identifier}`;
|
const url = `/arbitrary/resources/search?mode=ALL&service=${metadataProp?.service}&limit=1&includemetadata=true&reverse=true&excludeblocked=true&name=${encodeURIComponent(metadataProp?.name)}&exactmatchnames=true&offset=0&identifier=${encodeURIComponent(metadataProp?.identifier)}`;
|
||||||
const responseMetadata = await fetch(url, {
|
const responseMetadata = await fetch(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -88,7 +88,7 @@ export const useResources = (retryAttempts: number = 2) => {
|
|||||||
let metadata
|
let metadata
|
||||||
try {
|
try {
|
||||||
if (includeMetadata) {
|
if (includeMetadata) {
|
||||||
const url = `/arbitrary/resources/search?mode=ALL&service=${item?.service}&limit=1&includemetadata=true&reverse=true&excludeblocked=true&name=${item?.name}&exactmatchnames=true&offset=0&identifier=${item?.identifier}`;
|
const url = `/arbitrary/resources/search?mode=ALL&service=${item?.service}&limit=1&includemetadata=true&reverse=true&excludeblocked=true&name=${encodeURIComponent(item?.name)}&exactmatchnames=true&offset=0&identifier=${encodeURIComponent(item?.identifier)}`;
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
@ -109,7 +109,7 @@ export const useResources = (retryAttempts: number = 2) => {
|
|||||||
res = await requestQueueProductPublishes.enqueue(
|
res = await requestQueueProductPublishes.enqueue(
|
||||||
(): Promise<string> => {
|
(): Promise<string> => {
|
||||||
return getArbitraryResource(
|
return getArbitraryResource(
|
||||||
`/arbitrary/${item?.service}/${item?.name}/${item?.identifier}?encoding=base64`,
|
`/arbitrary/${item?.service}/${encodeURIComponent(item?.name)}/${encodeURIComponent(item?.identifier)}?encoding=base64`,
|
||||||
key
|
key
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ export const useResources = (retryAttempts: number = 2) => {
|
|||||||
return await requestQueueProductPublishesBackup.enqueue(
|
return await requestQueueProductPublishesBackup.enqueue(
|
||||||
(): Promise<string> => {
|
(): Promise<string> => {
|
||||||
return getArbitraryResource(
|
return getArbitraryResource(
|
||||||
`/arbitrary/${item?.service}/${item?.name}/${item?.identifier}?encoding=base64`,
|
`/arbitrary/${item?.service}/${encodeURIComponent(item?.name)}/${encodeURIComponent(item?.identifier)}?encoding=base64`,
|
||||||
key
|
key
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ export const useAuthStore = create<AuthState>((set) => ({
|
|||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
setUser: (user) =>
|
setUser: (user) =>
|
||||||
set({ address: user.address, publicKey: user.publicKey, name: user.name || null, avatarUrl: !user?.name ? null : `/arbitrary/THUMBNAIL/${user.name}/qortal_avatar?async=true` }),
|
set({ address: user.address, publicKey: user.publicKey, name: user.name || null, avatarUrl: !user?.name ? null : `/arbitrary/THUMBNAIL/${encodeURIComponent(user.name)}/qortal_avatar?async=true` }),
|
||||||
setBalance: (balance) => set({ balance }),
|
setBalance: (balance) => set({ balance }),
|
||||||
setIsLoadingUser: (loading) => set({ isLoadingUser: loading }),
|
setIsLoadingUser: (loading) => set({ isLoadingUser: loading }),
|
||||||
setIsLoadingBalance: (loading) => set({ isLoadingInitialBalance: loading }),
|
setIsLoadingBalance: (loading) => set({ isLoadingInitialBalance: loading }),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user