The cover of "The Cuckoo's Calling," a crime novel written by JK Rowling and released under a pseudonym. Mulholland Books

Some two weeks after “Harry Potter” author JK Rowling was revealed as the author of crime novel “The Cuckoo’s Calling,” her law firm has agreed to make a “substantial donation to charity” after inadvertently spilling the beans about Rowling’s authorship.

According to the Los Angeles Times, the law firm representing Rowling, Russells Solicitors, has agreed to pay Rowling’s legal fees in addition to the donation. Earlier in the month, an employee at the law firm let it slip that Rowling had penned “The Cuckoo’s Calling.”

Rowling originally wrote the mystery novel “The Cuckoo’s Calling” under the pseudonym Robert Galbraith, who was presented in promotional materials as a married ex-military man. Released in April, “The Cuckoo’s Calling” received excellent reviews but little commercial success until earlier in the month when Chris Gossage, a partner at Russells Solicitors, inadvertently leaked that Galbraith was really Rowling operating under a pseudonym.

Apparently eager to impress people, Gossage told his wife’s best friend, Judith Callegari, that Rowling was in fact the author of “Cuckoo’s Calling.” Soon after she learned the secret, Callegari tweeted a Sunday Times writer that Galbraith was really Rowling, setting off the entire chain of events that led to Rowling publicly acknowledging that she penned "The Cuckoo's Calling."

Rowling has reportedly brought legal action against Gossage and Callegari.

In addition to the donation from Russells Solicitors, Rowling has also agreed to donate three years’ worth of royalties from sales of “The Cuckoo’s Calling” to The Soldiers’ Charity, a British charity that provides support and assistance to soldiers and veterans, as well as to their familes.

"This donation is being made to The Soldiers' Charity partly as a thank you to the Army people who helped me with research, but also because writing a hero who is a veteran has given me an even greater appreciation and understanding of exactly how much this charity does for ex-servicemen and their families, and how much that support is needed,” Rowling said in a statement to the Independent.

"I always intended to give The Soldiers' Charity a donation out of Robert's royalties but I had not anticipated him making the bestseller list a mere three months after publication -- indeed, I had not counted on him ever being there!"

Officials overseeing the charity are more than pleased with Rowling’s donation.

"We are absolutely thrilled by the extraordinary generosity of JK Rowling who is such an internationally renowned author,” Major General Martin Rutledge, chief executive of the charity, told the Independent.

"This donation will make a huge difference to the lives of thousands of soldiers, former soldiers and their families who are in real need. Her tremendous show of support for The Soldiers' Charity will help to remind people of the many sacrifices made by our soldiers, long after any news of Afghanistan has left the front page."

Rowling may not be happy with her law firm’s breach of trust, but she certainly has to admit that the revelation did wonders for her sales. Only hours after word broke that Rowling was the book’s author, sales of “Cuckoo’s Calling” skyrocketed by 507,000 percent on Amazon, making the book Amazon’s best-selling novel for days straight.