Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate if old CID format is used #9020

Merged
merged 1 commit into from Apr 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion extensions/amp-analytics/0.1/cid-impl.js
Expand Up @@ -38,8 +38,9 @@ import {viewerForDoc} from '../../../src/services';
import {cryptoFor} from '../../../src/crypto';
import {tryParseJson} from '../../../src/json';
import {timerFor} from '../../../src/services';
import {user, rethrowAsync} from '../../../src/log';
import {dev, user, rethrowAsync} from '../../../src/log';

const TAG = 'cid';
const ONE_DAY_MILLIS = 24 * 3600 * 1000;

/**
Expand Down Expand Up @@ -313,8 +314,10 @@ export function viewerBaseCid(ampdoc, opt_data) {
}
const cidPromise = viewer.sendMessageAwaitResponse('cid', opt_data)
.then(data => {
// TODO(dvoytenko, #9019): cleanup the legacy CID format.
// For backward compatibility: #4029
if (data && !tryParseJson(data)) {
dev().error(TAG, 'invalid cid format');
return JSON.stringify({
time: Date.now(), // CID returned from old API is always fresh
cid: data,
Expand Down