A non-transitory computer readable storage medium to store a computer program to execute an object-sharing method for maintaining hierarchical naming contexts in a object sharing system, wherein the object-sharing method comprises:
- receiving an object-sharing request that intends to share an object having a first object path in a first object storage to a second object storage, in which the second object storage has a presented object having a second object path;
- comparing the first object path and the second object path and comparing a user information of the first and the second object storage;
- and
- determining whether a naming conflict condition occurs, in which the naming conflict condition occurs when the first object path is the same as the second object path or when a first prefix of the first object path is the same as a second prefix of the second object path;
- controlling the second object storage to receive the object from the first object storage and keep the first object path when the naming conflict condition does not occur;
- controlling the second object storage to receive the object from the first object storage and merging an overlapped part of the first object path and the second object path when the naming conflict condition occurs and the first object storage and the second object storage are from the same user;
- generating an alternative sharing destination in the second object storage to receive the object from the first object storage to the alternative sharing destination and keeping the first object path in the alternative sharing destination when the naming conflict condition occurs and the first object storage and the second object storage are not from the same user.