fix for ~ paths and tagging deduplication

This commit is contained in:
Garrett Serack 2020-02-27 08:37:44 -08:00
Родитель bd24ed1dfe
Коммит 8880301c13
2 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -86,6 +86,7 @@ export class Deduplicator {
private target: any;
constructor(originalFile: any, protected deduplicateInlineModels = false) {
this.target = clone(originalFile);
this.target.info['x-ms-metadata'].deduplicated = true;
}
private async init() {

Просмотреть файл

@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { exists, rmdir, readdir, mkdir, writeFile } from '@azure-tools/async-io';
import { resolve as uriResolve, parse as uriParse } from 'url';
import { homedir } from 'os';
/* eslint-disable */
export function simplifyUri(uri: string) {
@ -170,9 +171,14 @@ export function ToRawDataUrl(uri: string): string {
* @returns Absolute URI
*/
export function ResolveUri(baseUri: string, pathOrUri: string): string {
if (pathOrUri.startsWith('~/')) {
pathOrUri = pathOrUri.replace(/^~/, homedir())
}
if (isAbsolute(pathOrUri)) {
return CreateFileOrFolderUri(pathOrUri);
}
// known here: `pathOrUri` is eiher URI (relative or absolute) or relative path - which we can normalize to a relative URI
pathOrUri = pathOrUri.replace(/\\/g, '/');
// known here: `pathOrUri` is a URI (relative or absolute)