mirror of
https://github.com/upscayl/upscayl.git
synced 2025-02-07 15:01:24 +01:00
removed formatPath function,
also added missing regex to itemOne
This commit is contained in:
parent
d29e8600b3
commit
29d108d1e2
@ -480,15 +480,6 @@ const Home = () => {
|
|||||||
resetImagePaths();
|
resetImagePaths();
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatPath = (path) => {
|
|
||||||
//USE REGEX TO GET THE FILENAME AND ENCODE IT INTO PROPER FORM IN ORDER TO AVOID ERRORS DUE TO SPECIAL CHARACTERS
|
|
||||||
logit("📢 Formatting path: ", path);
|
|
||||||
return path.replace(
|
|
||||||
/([^/\\]+)$/i,
|
|
||||||
encodeURIComponent(path.match(/[^/\\]+$/i)[0])
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const allowedFileTypes = ["png", "jpg", "jpeg", "webp"];
|
const allowedFileTypes = ["png", "jpg", "jpeg", "webp"];
|
||||||
const allowedVideoFileTypes = ["webm", "mp4", "mkv"];
|
const allowedVideoFileTypes = ["webm", "mp4", "mkv"];
|
||||||
|
|
||||||
@ -629,7 +620,19 @@ const Home = () => {
|
|||||||
<img
|
<img
|
||||||
src={
|
src={
|
||||||
"file://" +
|
"file://" +
|
||||||
`${upscaledImagePath ? upscaledImagePath : imagePath}`
|
`${
|
||||||
|
upscaledImagePath
|
||||||
|
? upscaledImagePath.replace(
|
||||||
|
/([^/\\]+)$/i,
|
||||||
|
encodeURIComponent(
|
||||||
|
upscaledImagePath.match(/[^/\\]+$/i)[0]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
: imagePath.replace(
|
||||||
|
/([^/\\]+)$/i,
|
||||||
|
encodeURIComponent(imagePath.match(/[^/\\]+$/i)[0])
|
||||||
|
)
|
||||||
|
}`
|
||||||
}
|
}
|
||||||
onLoad={(e: any) => {
|
onLoad={(e: any) => {
|
||||||
setDimensions({
|
setDimensions({
|
||||||
@ -688,9 +691,13 @@ const Home = () => {
|
|||||||
|
|
||||||
<img
|
<img
|
||||||
/* USE REGEX TO GET THE FILENAME AND ENCODE IT INTO PROPER FORM IN ORDER TO AVOID ERRORS DUE TO SPECIAL CHARACTERS */
|
/* USE REGEX TO GET THE FILENAME AND ENCODE IT INTO PROPER FORM IN ORDER TO AVOID ERRORS DUE TO SPECIAL CHARACTERS */
|
||||||
src={"file:///" + imagePath.replace(
|
src={
|
||||||
/([^/\\]+)$/i,
|
"file:///" +
|
||||||
encodeURIComponent(imagePath.match(/[^/\\]+$/i)[0]))}
|
imagePath.replace(
|
||||||
|
/([^/\\]+)$/i,
|
||||||
|
encodeURIComponent(imagePath.match(/[^/\\]+$/i)[0])
|
||||||
|
)
|
||||||
|
}
|
||||||
alt="Original"
|
alt="Original"
|
||||||
onMouseMove={handleMouseMove}
|
onMouseMove={handleMouseMove}
|
||||||
style={{
|
style={{
|
||||||
@ -709,9 +716,15 @@ const Home = () => {
|
|||||||
</p>
|
</p>
|
||||||
<img
|
<img
|
||||||
/* USE REGEX TO GET THE FILENAME AND ENCODE IT INTO PROPER FORM IN ORDER TO AVOID ERRORS DUE TO SPECIAL CHARACTERS */
|
/* USE REGEX TO GET THE FILENAME AND ENCODE IT INTO PROPER FORM IN ORDER TO AVOID ERRORS DUE TO SPECIAL CHARACTERS */
|
||||||
src={"file://" + upscaledImagePath.replace(
|
src={
|
||||||
/([^/\\]+)$/i,
|
"file://" +
|
||||||
encodeURIComponent(upscaledImagePath.match(/[^/\\]+$/i)[0]))}
|
upscaledImagePath.replace(
|
||||||
|
/([^/\\]+)$/i,
|
||||||
|
encodeURIComponent(
|
||||||
|
upscaledImagePath.match(/[^/\\]+$/i)[0]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
alt="Upscayl"
|
alt="Upscayl"
|
||||||
style={{
|
style={{
|
||||||
objectFit: "contain",
|
objectFit: "contain",
|
||||||
@ -731,10 +744,15 @@ const Home = () => {
|
|||||||
{isVideo && videoPath.length > 0 && upscaledVideoPath.length === 0 && (
|
{isVideo && videoPath.length > 0 && upscaledVideoPath.length === 0 && (
|
||||||
<video autoPlay controls className="m-10 w-11/12 rounded-2xl">
|
<video autoPlay controls className="m-10 w-11/12 rounded-2xl">
|
||||||
<source
|
<source
|
||||||
src={"file://" + videoPath.replace(
|
src={
|
||||||
/([^/\\]+)$/i,
|
"file://" +
|
||||||
encodeURIComponent(videoPath.match(/[^/\\]+$/i)[0]))}
|
videoPath.replace(
|
||||||
type="video/mp4" />
|
/([^/\\]+)$/i,
|
||||||
|
encodeURIComponent(videoPath.match(/[^/\\]+$/i)[0])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
type="video/mp4"
|
||||||
|
/>
|
||||||
</video>
|
</video>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user