#!/usr/bin/python3
import json
import os
import sys


def migrate(values):
    if values.get('webdavNetwork', {}).get('certificateID', {}) == 0:
        values['webdavNetwork']['certificateID'] = None

    return values


if __name__ == '__main__':
    if len(sys.argv) != 2:
        exit(1)

    if os.path.exists(sys.argv[1]):
        with open(sys.argv[1], 'r') as f:
            print(json.dumps(migrate(json.loads(f.read()))))
