Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Body: assetContent,
Key: this.getAssetS3Key(id, asset.path)
})
.promise();
});
// Remove the temporary unpacking directory
await remove(unpackingDirPath);
// Create the bundle database object
const bundle = await this.Bundle.create({
id: id,
name: partial.name,
tag: partial.tag,
description: partial.description,
hash: md5(partial.content),
assets: assets,
fallbackAssetPath: partial.fallbackAssetPath,
fallbackStatusCode: partial.fallbackStatusCode
});
return toPojo(bundle);
}
getImgName(src: string) {
// 直接将路径信息md5
let filename = ''
try {
let srcMd5 = md5(src)
let urlObj = new url.URL(src)
let pathname = urlObj.pathname
if (path.extname(pathname) === '') {
// 避免没有后缀名
pathname = `${pathname}.jpg`
}
if (pathname.length > 50) {
// 文件名不能过长, 否则用户无法直接删除该文件
pathname = pathname.substr(pathname.length - 50, 50)
}
filename = StringUtil.encodeFilename(`${srcMd5}_${pathname}`)
} catch (e) {
// 非url, 不需要进行处理, 返回空即可
logger.warn(`[警告]传入值src:${src}不是合法url, 将返回空filename`)
}
return filename
start() {
this.createdAt = Date.now();
this.lastLogDate = this.createdAt;
this.stintID = md5(`session_${this.createdAt}`);
hashHistory.listen(
Util.debounce(location => {
Actions.setActivePage(location.pathname + location.search);
}, 200)
);
// Poll to deplete queue
const checkAnalyticsReady = () => {
setTimeout(() => {
if (!this.canLog()) {
checkAnalyticsReady();
} else {
this.drainQueue();
}
}, 200);
const openTagF = fileName => '<div data-filename="\"'">';
const closeTagF = () => '</div>';
get(url, params = {}) {
const key = md5(url + JSON.stringify(params))
if (config.cached && params.cache && config.cached.has(key)) {
return Promise.resolve(config.cached.get(key))
}
params.apiSource = 'server';
return axios({
method: 'get',
url: config.api + url,
params,
timeout: config.timeout,
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
}).then(res => {
if (config.cached && params.cache) config.cached.set(key, res)
return res
})
export function gravatarUrl (value, image, size) {
return `https://www.gravatar.com/avatar/${md5(toLower(value))}?d=${image}&s=${size}`
}
export function md5Hash(value) {
return md5(value);
}
userSchema.virtual("gravatar").get(function() {
const hash = md5(this.email);
return `https://gravatar.com/avatar/${hash}?s=30`;
});
.then((response) => {
dispatch({
type: `${USER_GET_INFO}_FULFILLED`,
payload: response
});
if (response.data.user) {
let hashedUserId = md5(response.data.user.name);
ReactGA.set({
userId: hashedUserId
});
saveToLocalStorage('hashedUID', hashedUserId);
}
if (response.data.settings) {
setSettings(dispatch)(response.data.settings, false);
}
});
}
export function getLinkId(userId: string, linkUrl: string) {
return md5(`${userId}-${linkUrl}`)
}