解决已知编码问题

This commit is contained in:
qxz 2020-05-17 13:29:48 +08:00
parent 6fd1c6d909
commit f9b84f213b
3 changed files with 42 additions and 35 deletions

View File

@ -23,7 +23,15 @@ let Base64 = require("js-base64").Base64;
// "gif", // "gif",
// ]; // ];
export const encodePath = (path) => {
return path.replace(/(.*)/, (p1, p2) => {
return p2.replace().replace(/\//g, "%2F").replace(/#/g, "%23")
})
//return path.replace().replace("/", "%2F").replace("#", "%23")
}
export const checkoutPath = (path, file) => { export const checkoutPath = (path, file) => {
path = encodePath(path)
if (file.mimeType === "application/vnd.google-apps.folder") { if (file.mimeType === "application/vnd.google-apps.folder") {
if (path.substr(-1) !== "/") { if (path.substr(-1) !== "/") {
path += "/"; path += "/";
@ -79,8 +87,7 @@ export const getURLParameters = (url) =>
.reduce( .reduce(
(a, v) => ( (a, v) => (
(a[v.slice(0, v.indexOf("="))] = v.slice(v.indexOf("=") + 1)), a (a[v.slice(0, v.indexOf("="))] = v.slice(v.indexOf("=") + 1)), a
), ), {}
{}
); );
// console.log(getURLParameters("/Movies/xx.mp4?a=view&y=123")); // console.log(getURLParameters("/Movies/xx.mp4?a=view&y=123"));

View File

@ -83,8 +83,8 @@ export default {
if (n == "") { if (n == "") {
continue; continue;
} }
n = decodeURI(n); n = decodeURIComponent(n);
p += n + "/"; p += arr[i] + "/";
// if (p.match("/[0-9]+:/")[0] === p) { // if (p.match("/[0-9]+:/")[0] === p) {
// n = this.$t('index'); // n = this.$t('index');
// } // }

View File

@ -19,7 +19,7 @@
<tbody> <tbody>
<tr v-for="(file, index) in data" v-bind:key="index"> <tr v-for="(file, index) in data" v-bind:key="index">
<td <td
@click=" @click.self="
go( go(
file, file,
file.mimeType !== 'application/vnd.google-apps.folder' file.mimeType !== 'application/vnd.google-apps.folder'
@ -32,7 +32,7 @@
<use :xlink:href="icons(file.mimeType)" /> <use :xlink:href="icons(file.mimeType)" />
</svg> </svg>
{{ file.name }} {{ file.name }}
<span class="has-text-grey g2-file-desc">{{ file.description }}</span> <span class="has-text-grey g2-file-desc" v-html="file.description"></span>
</td> </td>
<td class="is-hidden-mobile is-hidden-touch"> <td class="is-hidden-mobile is-hidden-touch">
{{ file.modifiedTime }} {{ file.modifiedTime }}