Skip to content

Commit

Permalink
Investigate if old CID format is used (ampproject#9020)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima Voytenko authored and Eric Kenney committed May 3, 2017
1 parent 366a15e commit 5dbd682
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 5dbd682

Please sign in to comment.